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

Commit7888b52

Browse files
committed
Make casts from xml to text independent of the XML option setting, thus
immutable and indexable. Also fix the volatility settings of some otherXML-related functions.
1 parent542d04e commit7888b52

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

‎src/backend/utils/adt/xml.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.60 2007/11/25 12:08:11 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.61 2007/11/27 12:21:05 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -535,7 +535,8 @@ xmltotext(PG_FUNCTION_ARGS)
535535
{
536536
xmltype*data=PG_GETARG_XML_P(0);
537537

538-
PG_RETURN_TEXT_P(xmltotext_with_xmloption(data,xmloption));
538+
/* It's actually binary compatible. */
539+
return (text*)data;
539540
}
540541

541542

‎src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.437 2007/10/24 02:24:47 tgl Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.438 2007/11/27 12:21:05 petere Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO200710232
56+
#defineCATALOG_VERSION_NO200711271
5757

5858
#endif

‎src/include/catalog/pg_cast.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Copyright (c) 2002-2007, PostgreSQL Global Development Group
1212
*
13-
* $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.36 2007/11/1521:14:42 momjian Exp $
13+
* $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.37 2007/11/27 12:21:05 petere Exp $
1414
*
1515
* NOTES
1616
* the genbki.sh script reads this file and generates .bki
@@ -292,7 +292,7 @@ DATA(insert ( 1560 23 1684 e ));
292292
DATA(insert (65025730a ));
293293
DATA(insert (86925730a ));
294294
DATA(insert (16252971a ));
295-
DATA(insert (142252922a ));
295+
DATA(insert (142250a ));
296296
DATA(insert (251422896e ));
297297

298298
/*
@@ -303,7 +303,7 @@ DATA(insert (25142 2896 e ));
303303
DATA(insert (6501043730a ));
304304
DATA(insert (8691043730a ));
305305
DATA(insert (1610432971a ));
306-
DATA(insert (14210432922a ));
306+
DATA(insert (14210430a ));
307307
DATA(insert (10431422896e ));
308308

309309
/*
@@ -314,7 +314,7 @@ DATA(insert ( 1043142 2896 e ));
314314
DATA(insert (6501042730a ));
315315
DATA(insert (8691042730a ));
316316
DATA(insert (1610422971a ));
317-
DATA(insert (14210422922a ));
317+
DATA(insert (14210420a ));
318318
DATA(insert (10421422896e ));
319319

320320
/*

‎src/include/catalog/pg_proc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.478 2007/11/1521:14:43 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.479 2007/11/27 12:21:05 petere Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -4028,13 +4028,13 @@ DATA(insert OID = 2892 ( pg_advisory_unlock_allPGNSP PGUID 12 1 0 f f t f v 0
40284028
DESCR("release all advisory locks");
40294029

40304030
/* XML support */
4031-
DATA(insertOID=2893 (xml_inPGNSPPGUID1210fftfi1142"2275"_null__null__null_xml_in-_null__null_ ));
4031+
DATA(insertOID=2893 (xml_inPGNSPPGUID1210fftfs1142"2275"_null__null__null_xml_in-_null__null_ ));
40324032
DESCR("I/O");
40334033
DATA(insertOID=2894 (xml_outPGNSPPGUID1210fftfi12275"142"_null__null__null_xml_out-_null__null_ ));
40344034
DESCR("I/O");
40354035
DATA(insertOID=2895 (xmlcommentPGNSPPGUID1210fftfi1142"25"_null__null__null_xmlcomment-_null__null_ ));
40364036
DESCR("generate an XML comment");
4037-
DATA(insertOID=2896 (xmlPGNSPPGUID1210fftfi1142"25"_null__null__null_texttoxml-_null__null_ ));
4037+
DATA(insertOID=2896 (xmlPGNSPPGUID1210fftfs1142"25"_null__null__null_texttoxml-_null__null_ ));
40384038
DESCR("perform a non-validating parse of a character string to produce an XML value");
40394039
DATA(insertOID=2897 (xmlvalidatePGNSPPGUID1210fftfi216"142 25"_null__null__null_xmlvalidate-_null__null_ ));
40404040
DESCR("validate an XML value");
@@ -4046,7 +4046,7 @@ DATA(insert OID = 2900 ( xmlconcat2 PGNSP PGUID 12 1 0 f f f f i 2 142 "142
40464046
DESCR("aggregate transition function");
40474047
DATA(insertOID=2901 (xmlaggPGNSPPGUID1210tfffi1142"142"_null__null__null_aggregate_dummy-_null__null_ ));
40484048
DESCR("concatenate XML values");
4049-
DATA(insertOID=2922 (textPGNSPPGUID1210fftfs125"142"_null__null__null_xmltotext-_null__null_ ));
4049+
DATA(insertOID=2922 (textPGNSPPGUID1210fftfi125"142"_null__null__null_xmltotext-_null__null_ ));
40504050
DESCR("serialize an XML value to a character string");
40514051

40524052
DATA(insertOID=2923 (table_to_xmlPGNSPPGUID121000fftfs4142"2205 16 16 25"_null__null_"{tbl,nulls,tableforest,targetns}"table_to_xml-_null__null_ ));

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ WHERE c.castfunc = p.oid AND
288288
-- those are binary-compatible while the reverse way goes through rtrim().
289289
-- As of 8.2, this finds the cast from cidr to inet, because that is a
290290
-- trivial binary coercion while the other way goes through inet_to_cidr().
291+
-- As of 8.3, this finds the casts from xml to text, varchar, and bpchar,
292+
-- because those are binary-compatible while the reverse goes through
293+
-- texttoxml(), which does an XML syntax check.
291294
SELECT *
292295
FROM pg_cast c
293296
WHERE c.castfunc = 0 AND
@@ -300,7 +303,10 @@ WHERE c.castfunc = 0 AND
300303
25 | 1042 | 0 | i
301304
1043 | 1042 | 0 | i
302305
650 | 869 | 0 | i
303-
(3 rows)
306+
142 | 25 | 0 | a
307+
142 | 1043 | 0 | a
308+
142 | 1042 | 0 | a
309+
(6 rows)
304310

305311
-- **************** pg_operator ****************
306312
-- Look for illegal values in pg_operator fields.

‎src/test/regress/sql/opr_sanity.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ WHERE c.castfunc = p.oid AND
238238
-- As of 8.2, this finds the cast from cidr to inet, because that is a
239239
-- trivial binary coercion while the other way goes through inet_to_cidr().
240240

241+
-- As of 8.3, this finds the casts from xml to text, varchar, and bpchar,
242+
-- because those are binary-compatible while the reverse goes through
243+
-- texttoxml(), which does an XML syntax check.
244+
241245
SELECT*
242246
FROM pg_cast c
243247
WHEREc.castfunc=0AND

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp