Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit94133a9

Browse files
committed
Mark operator implementation functions as such in their comments.
Historically, we've not had separate comments for built-in pg_operatorentries, but relied on the comments for the underlying functions. Thetrouble with this approach is that there isn't much of anything to suggestto users that they'd be better off using the operators instead. So, moveall the relevant comments into pg_operator, and give each underlyingfunction a comment that just says "implementation of XXX operator".There are only about half a dozen cases where it seems reasonable to usethe underlying function interchangeably with the operator; in these casesI 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 operatorentry should have a comment: there are now queries in the opr_sanityregression test that will complain if one doesn't. This only requiredadding a dozen or two more entries than would have been there anyway.I also spent some time trying to eliminate gratuitous inconsistencies inthe style of the comments, though it's hopeless to suppose that more won'tcreep in soon enough.Per my proposal of 2010-10-15.
1 parent091bda0 commit94133a9

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-
/* Typedescription */
912+
/* Typedescriptions */
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-
/* Ruledescription (ignore rules for views) */
958+
/* Ruledescriptions (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-
/* Triggerdescription */
980+
/* Triggerdescriptions */
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-
#defineCATALOG_VERSION_NO201102281
56+
#defineCATALOG_VERSION_NO201103031
5757

5858
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp