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

Commit788bce1

Browse files
committed
Add regression tests for XML mapping of domains
Pavel Stěhule
1 parenta18b72a commit788bce1

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,3 +1174,30 @@ SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
11741174

11751175
(1 row)
11761176

1177+
-- test that domains are transformed like their base types
1178+
CREATE DOMAIN testboolxmldomain AS bool;
1179+
CREATE DOMAIN testdatexmldomain AS date;
1180+
CREATE TABLE testxmlschema.test3
1181+
AS SELECT true c1,
1182+
true::testboolxmldomain c2,
1183+
'2013-02-21'::date c3,
1184+
'2013-02-21'::testdatexmldomain c4;
1185+
SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3;
1186+
xmlforest
1187+
------------------------------------------------------------------
1188+
<c1>true</c1><c2>true</c2><c3>2013-02-21</c3><c4>2013-02-21</c4>
1189+
(1 row)
1190+
1191+
SELECT table_to_xml('testxmlschema.test3', true, true, '');
1192+
table_to_xml
1193+
---------------------------------------------------------------
1194+
<test3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+
1195+
<c1>true</c1> +
1196+
<c2>true</c2> +
1197+
<c3>2013-02-21</c3> +
1198+
<c4>2013-02-21</c4> +
1199+
</test3> +
1200+
+
1201+
1202+
(1 row)
1203+

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,19 @@ SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
107107
ERROR: unsupported XML feature
108108
DETAIL: This functionality requires the server to be built with libxml support.
109109
HINT: You need to rebuild PostgreSQL using --with-libxml.
110+
-- test that domains are transformed like their base types
111+
CREATE DOMAIN testboolxmldomain AS bool;
112+
CREATE DOMAIN testdatexmldomain AS date;
113+
CREATE TABLE testxmlschema.test3
114+
AS SELECT true c1,
115+
true::testboolxmldomain c2,
116+
'2013-02-21'::date c3,
117+
'2013-02-21'::testdatexmldomain c4;
118+
SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3;
119+
ERROR: unsupported XML feature
120+
DETAIL: This functionality requires the server to be built with libxml support.
121+
HINT: You need to rebuild PostgreSQL using --with-libxml.
122+
SELECT table_to_xml('testxmlschema.test3', true, true, '');
123+
ERROR: unsupported XML feature
124+
DETAIL: This functionality requires the server to be built with libxml support.
125+
HINT: You need to rebuild PostgreSQL using --with-libxml.

‎src/test/regress/sql/xmlmap.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,18 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
3939
SELECT schema_to_xmlschema('testxmlschema', false, true,'');
4040
SELECT schema_to_xmlschema('testxmlschema', true, false,'');
4141
SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true,'foo');
42+
43+
44+
-- test that domains are transformed like their base types
45+
46+
CREATEDOMAINtestboolxmldomainAS bool;
47+
CREATEDOMAINtestdatexmldomainASdate;
48+
49+
CREATETABLEtestxmlschema.test3
50+
ASSELECT true c1,
51+
true::testboolxmldomain c2,
52+
'2013-02-21'::date c3,
53+
'2013-02-21'::testdatexmldomain c4;
54+
55+
SELECT xmlforest(c1, c2, c3, c4)FROMtestxmlschema.test3;
56+
SELECT table_to_xml('testxmlschema.test3', true, true,'');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp