Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 94133a9

Browse files
committed
Mark operator implementation functions as such in their comments.
Historically, we've not had separate comments for built-in pg_operator entries, but relied on the comments for the underlying functions. The trouble with this approach is that there isn't much of anything to suggest to users that they'd be better off using the operators instead. So, move all the relevant comments into pg_operator, and give each underlying function a comment that just says "implementation of XXX operator". There are only about half a dozen cases where it seems reasonable to use the underlying function interchangeably with the operator; in these cases I left the same comment in place on the function as on the operator. While at it, establish a policy that every built-in function and operator entry should have a comment: there are now queries in the opr_sanity regression test that will complain if one doesn't. This only required adding a dozen or two more entries than would have been there anyway. I also spent some time trying to eliminate gratuitous inconsistencies in the style of the comments, though it's hopeless to suppose that more won't creep in soon enough. Per my proposal of 2010-10-15.
1 parent 091bda0 commit 94133a9

File tree

6 files changed

+1676
-838
lines changed

6 files changed

+1676
-838
lines changed

src/bin/psql/describe.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,19 @@ describeOperators(const char *pattern, bool showSystem)
559559

560560
initPQExpBuffer(&buf);
561561

562+
/*
563+
* Note: before Postgres 9.1, we did not assign comments to any built-in
564+
* operators, preferring to let the comment on the underlying function
565+
* suffice. The coalesce() on the obj_description() calls below supports
566+
* this convention by providing a fallback lookup of a comment on the
567+
* operator's function. As of 9.1 there is a policy that every built-in
568+
* operator should have a comment; so the coalesce() is no longer
569+
* necessary so far as built-in operators are concerned. We keep it
570+
* anyway, for now, because (1) third-party modules may still be following
571+
* the old convention, and (2) we'd need to do it anyway when talking to a
572+
* pre-9.1 server.
573+
*/
574+
562575
printfPQExpBuffer(&buf,
563576
"SELECT n.nspname as \"%s\",\n"
564577
" o.oprname AS \"%s\",\n"
@@ -877,7 +890,7 @@ objectDescription(const char *pattern, bool showSystem)
877890
"n.nspname", "p.proname", NULL,
878891
"pg_catalog.pg_function_is_visible(p.oid)");
879892

880-
/* Operator descriptions (only if operator has its own comment) */
893+
/* Operator descriptions */
881894
appendPQExpBuffer(&buf,
882895
"UNION ALL\n"
883896
" SELECT o.oid as oid, o.tableoid as tableoid,\n"
@@ -896,7 +909,7 @@ objectDescription(const char *pattern, bool showSystem)
896909
"n.nspname", "o.oprname", NULL,
897910
"pg_catalog.pg_operator_is_visible(o.oid)");
898911

899-
/* Type description */
912+
/* Type descriptions */
900913
appendPQExpBuffer(&buf,
901914
"UNION ALL\n"
902915
" SELECT t.oid as oid, t.tableoid as tableoid,\n"
@@ -942,7 +955,7 @@ objectDescription(const char *pattern, bool showSystem)
942955
"n.nspname", "c.relname", NULL,
943956
"pg_catalog.pg_table_is_visible(c.oid)");
944957

945-
/* Rule description (ignore rules for views) */
958+
/* Rule descriptions (ignore rules for views) */
946959
appendPQExpBuffer(&buf,
947960
"UNION ALL\n"
948961
" SELECT r.oid as oid, r.tableoid as tableoid,\n"
@@ -964,7 +977,7 @@ objectDescription(const char *pattern, bool showSystem)
964977
"n.nspname", "r.rulename", NULL,
965978
"pg_catalog.pg_table_is_visible(c.oid)");
966979

967-
/* Trigger description */
980+
/* Trigger descriptions */
968981
appendPQExpBuffer(&buf,
969982
"UNION ALL\n"
970983
" SELECT t.oid as oid, t.tableoid as tableoid,\n"

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201102281
56+
#define CATALOG_VERSION_NO 201103031
5757

5858
#endif

0 commit comments

Comments
 (0)