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

Commit 908ab80

Browse files
committed
Further refine patch for commenting operator implementation functions.
Instead of manually maintaining the "implementation of XXX operator" comments in pg_proc.h, delete all those entries and let initdb create them via a join. To let initdb figure out which name to use when there is a conflict, change the comments for deprecated operators to say they are deprecated --- which seems like a good thing to do anyway.
1 parent 94be9e3 commit 908ab80

File tree

6 files changed

+86
-742
lines changed

6 files changed

+86
-742
lines changed

src/bin/initdb/initdb.c

+13
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,19 @@ setup_description(void)
14941494
" FROM tmp_pg_shdescription t, pg_class c "
14951495
" WHERE c.relname = t.classname;\n");
14961496

1497+
/* Create default descriptions for operator implementation functions */
1498+
PG_CMD_PUTS("WITH funcdescs AS ( "
1499+
"SELECT p.oid as p_oid, oprname, "
1500+
"coalesce(obj_description(o.oid, 'pg_operator'),'') as opdesc "
1501+
"FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) "
1502+
"INSERT INTO pg_description "
1503+
" SELECT p_oid, 'pg_proc'::regclass, 0, "
1504+
" 'implementation of ' || oprname || ' operator' "
1505+
" FROM funcdescs "
1506+
" WHERE opdesc NOT LIKE 'deprecated%' AND "
1507+
" NOT EXISTS (SELECT 1 FROM pg_description "
1508+
" WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n");
1509+
14971510
PG_CMD_CLOSE;
14981511

14991512
check_ok();

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

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

5858
#endif

src/include/catalog/pg_operator.h

+29-22
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ typedef FormData_pg_operator *Form_pg_operator;
8383
* ----------------
8484
*/
8585

86+
/*
87+
* Note: every entry in pg_operator.h is expected to have a DESCR() comment.
88+
* If the operator is a deprecated equivalent of some other entry, be sure
89+
* to comment it as such so that initdb doesn't think it's a preferred name
90+
* for the underlying function.
91+
*/
92+
8693
DATA(insert OID = 15 ( "=" PGNSP PGUID b t t 23 20 16 416 36 int48eq eqsel eqjoinsel ));
8794
DESCR("equal");
8895
DATA(insert OID = 36 ( "<>" PGNSP PGUID b f f 23 20 16 417 15 int48ne neqsel neqjoinsel ));
@@ -141,7 +148,7 @@ DESCR("equal");
141148
DATA(insert OID = 388 ( "!" PGNSP PGUID r f f 20 0 1700 0 0 numeric_fac - - ));
142149
DESCR("factorial");
143150
DATA(insert OID = 389 ( "!!" PGNSP PGUID l f f 0 20 1700 0 0 numeric_fac - - ));
144-
DESCR("factorial");
151+
DESCR("deprecated, use ! instead");
145152
DATA(insert OID = 385 ( "=" PGNSP PGUID b f t 29 29 16 385 0 cideq eqsel eqjoinsel ));
146153
DESCR("equal");
147154
DATA(insert OID = 386 ( "=" PGNSP PGUID b f t 22 22 16 386 0 int2vectoreq eqsel eqjoinsel ));
@@ -641,7 +648,7 @@ DESCR("is above (allows touching)");
641648
DATA(insert OID = 801 ( "<^" PGNSP PGUID b f f 603 603 16 0 0 box_below_eq positionsel positionjoinsel ));
642649
DESCR("is below (allows touching)");
643650
DATA(insert OID = 802 ( "?#" PGNSP PGUID b f f 603 603 16 0 0 box_overlap areasel areajoinsel ));
644-
DESCR("overlaps");
651+
DESCR("deprecated, use && instead");
645652
DATA(insert OID = 803 ( "#" PGNSP PGUID b f f 603 603 603 0 0 box_intersect - - ));
646653
DESCR("box intersection");
647654
DATA(insert OID = 804 ( "+" PGNSP PGUID b f f 603 600 603 0 0 box_add - - ));
@@ -1521,41 +1528,41 @@ DESCR("concatenate");
15211528

15221529
/* obsolete names for contains/contained-by operators; remove these someday */
15231530
DATA(insert OID = 2860 ( "@" PGNSP PGUID b f f 604 604 16 2861 0 poly_contained contsel contjoinsel ));
1524-
DESCR("is contained by");
1531+
DESCR("deprecated, use <@ instead");
15251532
DATA(insert OID = 2861 ( "~" PGNSP PGUID b f f 604 604 16 2860 0 poly_contain contsel contjoinsel ));
1526-
DESCR("contains");
1533+
DESCR("deprecated, use @> instead");
15271534
DATA(insert OID = 2862 ( "@" PGNSP PGUID b f f 603 603 16 2863 0 box_contained contsel contjoinsel ));
1528-
DESCR("is contained by");
1535+
DESCR("deprecated, use <@ instead");
15291536
DATA(insert OID = 2863 ( "~" PGNSP PGUID b f f 603 603 16 2862 0 box_contain contsel contjoinsel ));
1530-
DESCR("contains");
1537+
DESCR("deprecated, use @> instead");
15311538
DATA(insert OID = 2864 ( "@" PGNSP PGUID b f f 718 718 16 2865 0 circle_contained contsel contjoinsel ));
1532-
DESCR("is contained by");
1539+
DESCR("deprecated, use <@ instead");
15331540
DATA(insert OID = 2865 ( "~" PGNSP PGUID b f f 718 718 16 2864 0 circle_contain contsel contjoinsel ));
1534-
DESCR("contains");
1541+
DESCR("deprecated, use @> instead");
15351542
DATA(insert OID = 2866 ( "@" PGNSP PGUID b f f 600 603 16 0 0 on_pb - - ));
1536-
DESCR("point inside box");
1543+
DESCR("deprecated, use <@ instead");
15371544
DATA(insert OID = 2867 ( "@" PGNSP PGUID b f f 600 602 16 2868 0 on_ppath - - ));
1538-
DESCR("point within closed path, or point on open path");
1545+
DESCR("deprecated, use <@ instead");
15391546
DATA(insert OID = 2868 ( "~" PGNSP PGUID b f f 602 600 16 2867 0 path_contain_pt - - ));
1540-
DESCR("contains");
1547+
DESCR("deprecated, use @> instead");
15411548
DATA(insert OID = 2869 ( "@" PGNSP PGUID b f f 600 604 16 2870 0 pt_contained_poly - - ));
1542-
DESCR("is contained by");
1549+
DESCR("deprecated, use <@ instead");
15431550
DATA(insert OID = 2870 ( "~" PGNSP PGUID b f f 604 600 16 2869 0 poly_contain_pt - - ));
1544-
DESCR("contains");
1551+
DESCR("deprecated, use @> instead");
15451552
DATA(insert OID = 2871 ( "@" PGNSP PGUID b f f 600 718 16 2872 0 pt_contained_circle - - ));
1546-
DESCR("is contained by");
1553+
DESCR("deprecated, use <@ instead");
15471554
DATA(insert OID = 2872 ( "~" PGNSP PGUID b f f 718 600 16 2871 0 circle_contain_pt - - ));
1548-
DESCR("contains");
1555+
DESCR("deprecated, use @> instead");
15491556
DATA(insert OID = 2873 ( "@" PGNSP PGUID b f f 600 628 16 0 0 on_pl - - ));
1550-
DESCR("point on line");
1557+
DESCR("deprecated, use <@ instead");
15511558
DATA(insert OID = 2874 ( "@" PGNSP PGUID b f f 600 601 16 0 0 on_ps - - ));
1552-
DESCR("is contained by");
1559+
DESCR("deprecated, use <@ instead");
15531560
DATA(insert OID = 2875 ( "@" PGNSP PGUID b f f 601 628 16 0 0 on_sl - - ));
1554-
DESCR("lseg on line");
1561+
DESCR("deprecated, use <@ instead");
15551562
DATA(insert OID = 2876 ( "@" PGNSP PGUID b f f 601 603 16 0 0 on_sb - - ));
1556-
DESCR("is contained by");
1563+
DESCR("deprecated, use <@ instead");
15571564
DATA(insert OID = 2877 ( "~" PGNSP PGUID b f f 1034 1033 16 0 0 aclcontains - - ));
1558-
DESCR("contains");
1565+
DESCR("deprecated, use @> instead");
15591566

15601567
/* uuid operators */
15611568
DATA(insert OID = 2972 ( "=" PGNSP PGUID b t t 2950 2950 16 2972 2973 uuid_eq eqsel eqjoinsel ));
@@ -1607,9 +1614,9 @@ DESCR("text search match");
16071614
DATA(insert OID = 3637 ( "@@" PGNSP PGUID b f f 3615 3614 16 3636 0 ts_match_qv tsmatchsel tsmatchjoinsel ));
16081615
DESCR("text search match");
16091616
DATA(insert OID = 3660 ( "@@@" PGNSP PGUID b f f 3614 3615 16 3661 0 ts_match_vq tsmatchsel tsmatchjoinsel ));
1610-
DESCR("text search match");
1617+
DESCR("deprecated, use @@ instead");
16111618
DATA(insert OID = 3661 ( "@@@" PGNSP PGUID b f f 3615 3614 16 3660 0 ts_match_qv tsmatchsel tsmatchjoinsel ));
1612-
DESCR("text search match");
1619+
DESCR("deprecated, use @@ instead");
16131620
DATA(insert OID = 3674 ( "<" PGNSP PGUID b f f 3615 3615 16 3679 3678 tsquery_lt scalarltsel scalarltjoinsel ));
16141621
DESCR("less than");
16151622
DATA(insert OID = 3675 ( "<=" PGNSP PGUID b f f 3615 3615 16 3678 3679 tsquery_le scalarltsel scalarltjoinsel ));

0 commit comments

Comments
 (0)