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

Commit3db6524

Browse files
committed
Mark some more I/O-conversion-invoking functions as stable not volatile.
When written, textanycat, anytextcat, quote_literal, and quote_nullablewere marked volatile, because they could invoke arbitrary type-specificoutput functions as part of casting their anyelement arguments to text.Since then, we have defined a project policy that I/O functions must notbe volatile, as per commitaab353a.So these functions can safely be downgraded to stable. Most of the timethis makes no difference since they'll get inlined anyway, but as notedby Andrew Dunstan, there are cases where the volatile marking preventsoptimizations that the planner does before function inlining. (I thinkI might have overlooked these functions in the earlier commit on thegrounds that inlining would make it moot, but not so --- tgl)This change results in a change in the expected output of the jsonregression tests, because the planner can now flatten a sub-selectthat it failed to before. The old output is preferable, but gettingthat back will require some as-yet-unfinished work on RowExpr handling.Marti Raudsepp
1 parentc138979 commit3db6524

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

‎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_NO201202081
56+
#defineCATALOG_VERSION_NO201202082
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,11 +2273,11 @@ DATA(insert OID = 1282 ( quote_ident PGNSP PGUID 12 1 0 0 0 f f f t f i 1 0
22732273
DESCR("quote an identifier for usage in a querystring");
22742274
DATA(insertOID=1283 (quote_literalPGNSPPGUID121000ffftfi1025"25"_null__null__null__null_quote_literal_null__null__null_ ));
22752275
DESCR("quote a literal for usage in a querystring");
2276-
DATA(insertOID=1285 (quote_literalPGNSPPGUID141000ffftfv1025"2283"_null__null__null__null_"select pg_catalog.quote_literal($1::pg_catalog.text)"_null__null__null_ ));
2276+
DATA(insertOID=1285 (quote_literalPGNSPPGUID141000ffftfs1025"2283"_null__null__null__null_"select pg_catalog.quote_literal($1::pg_catalog.text)"_null__null__null_ ));
22772277
DESCR("quote a data value for usage in a querystring");
22782278
DATA(insertOID=1289 (quote_nullablePGNSPPGUID121000fffffi1025"25"_null__null__null__null_quote_nullable_null__null__null_ ));
22792279
DESCR("quote a possibly-null literal for usage in a querystring");
2280-
DATA(insertOID=1290 (quote_nullablePGNSPPGUID141000fffffv1025"2283"_null__null__null__null_"select pg_catalog.quote_nullable($1::pg_catalog.text)"_null__null__null_ ));
2280+
DATA(insertOID=1290 (quote_nullablePGNSPPGUID141000fffffs1025"2283"_null__null__null__null_"select pg_catalog.quote_nullable($1::pg_catalog.text)"_null__null__null_ ));
22812281
DESCR("quote a possibly-null data value for usage in a querystring");
22822282

22832283
DATA(insertOID=1798 (oidinPGNSPPGUID121000ffftfi1026"2275"_null__null__null__null_oidin_null__null__null_ ));
@@ -2753,8 +2753,8 @@ DESCR("adjust time precision");
27532753
DATA(insertOID=1969 (timetzPGNSPPGUID121003944ffftfi201266"1266 23"_null__null__null__null_timetz_scale_null__null__null_ ));
27542754
DESCR("adjust time with time zone precision");
27552755

2756-
DATA(insertOID=2003 (textanycatPGNSPPGUID141000ffftfv2025"25 2776"_null__null__null__null_"select $1 || $2::pg_catalog.text"_null__null__null_ ));
2757-
DATA(insertOID=2004 (anytextcatPGNSPPGUID141000ffftfv2025"2776 25"_null__null__null__null_"select $1::pg_catalog.text || $2"_null__null__null_ ));
2756+
DATA(insertOID=2003 (textanycatPGNSPPGUID141000ffftfs2025"25 2776"_null__null__null__null_"select $1 || $2::pg_catalog.text"_null__null__null_ ));
2757+
DATA(insertOID=2004 (anytextcatPGNSPPGUID141000ffftfs2025"2776 25"_null__null__null__null_"select $1::pg_catalog.text || $2"_null__null__null_ ));
27582758

27592759
DATA(insertOID=2005 (bytealikePGNSPPGUID121000ffftfi2016"17 17"_null__null__null__null_bytealike_null__null__null_ ));
27602760
DATA(insertOID=2006 (byteanlikePGNSPPGUID121000ffftfi2016"17 17"_null__null__null__null_byteanlike_null__null__null_ ));

‎src/test/regress/expected/json.out

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ SELECT array_to_json(array_agg(q),false)
284284
ROW(y.*,ARRAY[4,5,6])] AS z
285285
FROM generate_series(1,2) x,
286286
generate_series(4,5) y) q;
287-
array_to_json
288-
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
289-
[{"b":"a1","c":4,"z":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]},{"b":"a1","c":5,"z":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]},{"b":"a2","c":4,"z":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]},{"b":"a2","c":5,"z":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}]
287+
array_to_json
288+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
289+
[{"f1":"a1","f2":4,"f3":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]},{"f1":"a1","f2":5,"f3":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]},{"f1":"a2","f2":4,"f3":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]},{"f1":"a2","f2":5,"f3":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}]
290290
(1 row)
291291

292292
SELECT array_to_json(array_agg(x),false) from generate_series(5,10) x;
@@ -315,12 +315,12 @@ FROM (SELECT $$a$$ || x AS b,
315315
ROW(y.*,ARRAY[4,5,6])] AS z
316316
FROM generate_series(1,2) x,
317317
generate_series(4,5) y) q;
318-
row_to_json
319-
--------------------------------------------------------------------
320-
{"b":"a1","c":4,"z":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
321-
{"b":"a1","c":5,"z":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
322-
{"b":"a2","c":4,"z":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
323-
{"b":"a2","c":5,"z":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
318+
row_to_json
319+
-----------------------------------------------------------------------
320+
{"f1":"a1","f2":4,"f3":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
321+
{"f1":"a1","f2":5,"f3":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
322+
{"f1":"a2","f2":4,"f3":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
323+
{"f1":"a2","f2":5,"f3":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
324324
(4 rows)
325325

326326
SELECT row_to_json(q,true)
@@ -330,20 +330,20 @@ FROM (SELECT $$a$$ || x AS b,
330330
ROW(y.*,ARRAY[4,5,6])] AS z
331331
FROM generate_series(1,2) x,
332332
generate_series(4,5) y) q;
333-
row_to_json
334-
-----------------------------------------------------
335-
{"b":"a1", +
336-
"c":4, +
337-
"z":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
338-
{"b":"a1", +
339-
"c":5, +
340-
"z":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
341-
{"b":"a2", +
342-
"c":4, +
343-
"z":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
344-
{"b":"a2", +
345-
"c":5, +
346-
"z":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
333+
row_to_json
334+
------------------------------------------------------
335+
{"f1":"a1", +
336+
"f2":4, +
337+
"f3":[{"f1":1,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
338+
{"f1":"a1", +
339+
"f2":5, +
340+
"f3":[{"f1":1,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
341+
{"f1":"a2", +
342+
"f2":4, +
343+
"f3":[{"f1":2,"f2":[1,2,3]},{"f1":4,"f2":[4,5,6]}]}
344+
{"f1":"a2", +
345+
"f2":5, +
346+
"f3":[{"f1":2,"f2":[1,2,3]},{"f1":5,"f2":[4,5,6]}]}
347347
(4 rows)
348348

349349
CREATE TEMP TABLE rows AS

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp