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

Commit c3096d5

Browse files
committed
Get rid of bogus separate pg_proc entries for json_extract_path operators.
These should not have existed to begin with, but there was apparently some misunderstanding of the purpose of the opr_sanity regression test item that checks for operator implementation functions with their own comments. The idea there is to check for unintentional violations of the rule that operator implementation functions shouldn't be documented separately .... but for these functions, that is in fact what we want, since the variadic option is useful and not accessible via the operator syntax. Get rid of the extra pg_proc entries and fix the regression test and documentation to be explicit about what we're doing here.
1 parent 9738374 commit c3096d5

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

doc/src/sgml/func.sgml

+4-2
Original file line numberDiff line numberDiff line change
@@ -10524,7 +10524,8 @@ table2-mapping
1052410524
<entry><para><type>json</type></para><para><type>jsonb</type>
1052510525
</para></entry>
1052610526
<entry>
10527-
Returns JSON value pointed to by <replaceable>path_elems</replaceable>.
10527+
Returns JSON value pointed to by <replaceable>path_elems</replaceable>
10528+
(equivalent to <literal>#&gt;</literal> operator).
1052810529
</entry>
1052910530
<entry><literal>json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}','f4')</literal></entry>
1053010531
<entry><literal>{"f5":99,"f6":"foo"}</literal></entry>
@@ -10536,7 +10537,8 @@ table2-mapping
1053610537
<entry><type>text</type></entry>
1053710538
<entry>
1053810539
Returns JSON value pointed to by <replaceable>path_elems</replaceable>
10539-
as <type>text</>.
10540+
as <type>text</>
10541+
(equivalent to <literal>#&gt;&gt;</literal> operator).
1054010542
</entry>
1054110543
<entry><literal>json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}','f4', 'f6')</literal></entry>
1054210544
<entry><literal>foo</literal></entry>

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 201406121
56+
#define CATALOG_VERSION_NO 201406261
5757

5858
#endif

src/include/catalog/pg_operator.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,9 @@ DATA(insert OID = 3964 ( "->" PGNSP PGUID b f f 114 23 114 0 0 json_array_el
17671767
DESCR("get json array element");
17681768
DATA(insert OID = 3965 ( "->>" PGNSP PGUID b f f 114 23 25 0 0 json_array_element_text - - ));
17691769
DESCR("get json array element as text");
1770-
DATA(insert OID = 3966 ( "#>" PGNSP PGUID b f f 114 1009 114 0 0 json_extract_path_op - - ));
1770+
DATA(insert OID = 3966 ( "#>" PGNSP PGUID b f f 114 1009 114 0 0 json_extract_path - - ));
17711771
DESCR("get value from json with path elements");
1772-
DATA(insert OID = 3967 ( "#>>" PGNSP PGUID b f f 114 1009 25 0 0 json_extract_path_text_op - - ));
1772+
DATA(insert OID = 3967 ( "#>>" PGNSP PGUID b f f 114 1009 25 0 0 json_extract_path_text - - ));
17731773
DESCR("get value from json as text with path elements");
17741774
DATA(insert OID = 3211 ( "->" PGNSP PGUID b f f 3802 25 3802 0 0 jsonb_object_field - - ));
17751775
DESCR("get jsonb object field");
@@ -1779,9 +1779,9 @@ DATA(insert OID = 3212 ( "->" PGNSP PGUID b f f 3802 23 3802 0 0 jsonb_array
17791779
DESCR("get jsonb array element");
17801780
DATA(insert OID = 3481 ( "->>" PGNSP PGUID b f f 3802 23 25 0 0 jsonb_array_element_text - - ));
17811781
DESCR("get jsonb array element as text");
1782-
DATA(insert OID = 3213 ( "#>" PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_extract_path_op - - ));
1782+
DATA(insert OID = 3213 ( "#>" PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_extract_path - - ));
17831783
DESCR("get value from jsonb with path elements");
1784-
DATA(insert OID = 3206 ( "#>>" PGNSP PGUID b f f 3802 1009 25 0 0 jsonb_extract_path_text_op - - ));
1784+
DATA(insert OID = 3206 ( "#>>" PGNSP PGUID b f f 3802 1009 25 0 0 jsonb_extract_path_text - - ));
17851785
DESCR("get value from jsonb as text with path elements");
17861786
DATA(insert OID = 3240 ( "=" PGNSP PGUID b t t 3802 3802 16 3240 3241 jsonb_eq eqsel eqjoinsel ));
17871787
DESCR("equal");

src/include/catalog/pg_proc.h

-4
Original file line numberDiff line numberDiff line change
@@ -4230,10 +4230,8 @@ DATA(insert OID = 3949 ( json_array_element PGNSP PGUID 12 1 0 0 0 f f f f t f
42304230
DATA(insert OID = 3950 ( json_array_element_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "114 23" _null_ _null_ "{from_json, element_index}" _null_ json_array_element_text _null_ _null_ _null_ ));
42314231
DATA(insert OID = 3951 ( json_extract_path PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 114 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ json_extract_path _null_ _null_ _null_ ));
42324232
DESCR("get value from json with path elements");
4233-
DATA(insert OID = 3952 ( json_extract_path_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 1009" _null_ _null_ "{from_json,path_elems}" _null_ json_extract_path _null_ _null_ _null_ ));
42344233
DATA(insert OID = 3953 ( json_extract_path_text PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ json_extract_path_text _null_ _null_ _null_ ));
42354234
DESCR("get value from json as text with path elements");
4236-
DATA(insert OID = 3954 ( json_extract_path_text_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "114 1009" _null_ _null_ "{from_json,path_elems}" _null_ json_extract_path_text _null_ _null_ _null_ ));
42374235
DATA(insert OID = 3955 ( json_array_elements PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 114 "114" "{114,114}" "{i,o}" "{from_json,value}" _null_ json_array_elements _null_ _null_ _null_ ));
42384236
DESCR("key value pairs of a json object");
42394237
DATA(insert OID = 3969 ( json_array_elements_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "114" "{114,25}" "{i,o}" "{from_json,value}" _null_ json_array_elements_text _null_ _null_ _null_ ));
@@ -4593,10 +4591,8 @@ DATA(insert OID = 3215 ( jsonb_array_element PGNSP PGUID 12 1 0 0 0 f f f f t
45934591
DATA(insert OID = 3216 ( jsonb_array_element_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "3802 23" _null_ _null_ "{from_json, element_index}" _null_ jsonb_array_element_text _null_ _null_ _null_ ));
45944592
DATA(insert OID = 3217 ( jsonb_extract_path PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 3802 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ jsonb_extract_path _null_ _null_ _null_ ));
45954593
DESCR("get value from jsonb with path elements");
4596-
DATA(insert OID = 3939 ( jsonb_extract_path_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 1009" _null_ _null_ "{from_json,path_elems}" _null_ jsonb_extract_path _null_ _null_ _null_ ));
45974594
DATA(insert OID = 3940 ( jsonb_extract_path_text PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ jsonb_extract_path_text _null_ _null_ _null_ ));
45984595
DESCR("get value from jsonb as text with path elements");
4599-
DATA(insert OID = 3218 ( jsonb_extract_path_text_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "3802 1009" _null_ _null_ "{from_json,path_elems}" _null_ jsonb_extract_path_text _null_ _null_ _null_ ));
46004596
DATA(insert OID = 3219 ( jsonb_array_elements PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 3802 "3802" "{3802,3802}" "{i,o}" "{from_json,value}" _null_ jsonb_array_elements _null_ _null_ _null_ ));
46014597
DESCR("elements of a jsonb array");
46024598
DATA(insert OID = 3465 ( jsonb_array_elements_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "3802" "{3802,25}" "{i,o}" "{from_json,value}" _null_ jsonb_array_elements_text _null_ _null_ _null_ ));

src/test/regress/expected/opr_sanity.out

+12-8
Original file line numberDiff line numberDiff line change
@@ -1045,14 +1045,18 @@ SELECT p_oid, proname, prodesc FROM funcdescs
10451045
WHERE prodesc IS DISTINCT FROM expecteddesc
10461046
AND oprdesc NOT LIKE 'deprecated%'
10471047
ORDER BY 1;
1048-
p_oid | proname | prodesc
1049-
-------+---------------+-------------------------------------
1050-
378 | array_append | append element onto end of array
1051-
379 | array_prepend | prepend element onto front of array
1052-
1035 | aclinsert | add/update ACL item
1053-
1036 | aclremove | remove ACL item
1054-
1037 | aclcontains | contains
1055-
(5 rows)
1048+
p_oid | proname | prodesc
1049+
-------+-------------------------+-------------------------------------------------
1050+
378 | array_append | append element onto end of array
1051+
379 | array_prepend | prepend element onto front of array
1052+
1035 | aclinsert | add/update ACL item
1053+
1036 | aclremove | remove ACL item
1054+
1037 | aclcontains | contains
1055+
3217 | jsonb_extract_path | get value from jsonb with path elements
1056+
3940 | jsonb_extract_path_text | get value from jsonb as text with path elements
1057+
3951 | json_extract_path | get value from json with path elements
1058+
3953 | json_extract_path_text | get value from json as text with path elements
1059+
(9 rows)
10561060

10571061
-- **************** pg_aggregate ****************
10581062
-- Look for illegal values in pg_aggregate fields.

0 commit comments

Comments
 (0)