Skip to content

Commit f5260d5

Browse files
committed
Fix previous commit's test, for non-UTF8 databases with non-XML builds.
To ensure stable output, catch one more configuration-specific error. Back-patch to 9.3, like the commit that added the test.
1 parent d8406b9 commit f5260d5

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

src/test/regress/expected/xml.out

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,12 @@ DECLARE
660660
degree_symbol text;
661661
res xml[];
662662
BEGIN
663-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
664-
-- the server encoding is not UTF8. The EXCEPTION block below,
665-
-- currently dead code, will be relevant if we remove this limitation.
663+
-- Per the documentation, except when the server encoding is UTF8, xpath()
664+
-- may not work on non-ASCII data. The untranslatable_character and
665+
-- undefined_function traps below, currently dead code, will become relevant
666+
-- if we remove this limitation.
666667
IF current_setting('server_encoding') <> 'UTF8' THEN
667-
RAISE LOG 'skip: encoding % unsupported for xml',
668+
RAISE LOG 'skip: encoding % unsupported for xpath',
668669
current_setting('server_encoding');
669670
RETURN;
670671
END IF;
@@ -679,9 +680,12 @@ BEGIN
679680
END IF;
680681
EXCEPTION
681682
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
682-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
683+
WHEN untranslatable_character
683684
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
684-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
685+
OR undefined_function
686+
-- unsupported XML feature
687+
OR feature_not_supported THEN
688+
RAISE LOG 'skip: %', SQLERRM;
685689
END
686690
$$;
687691
-- Test xmlexists and xpath_exists

src/test/regress/expected/xml_1.out

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,12 @@ DECLARE
571571
degree_symbol text;
572572
res xml[];
573573
BEGIN
574-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
575-
-- the server encoding is not UTF8. The EXCEPTION block below,
576-
-- currently dead code, will be relevant if we remove this limitation.
574+
-- Per the documentation, except when the server encoding is UTF8, xpath()
575+
-- may not work on non-ASCII data. The untranslatable_character and
576+
-- undefined_function traps below, currently dead code, will become relevant
577+
-- if we remove this limitation.
577578
IF current_setting('server_encoding') <> 'UTF8' THEN
578-
RAISE LOG 'skip: encoding % unsupported for xml',
579+
RAISE LOG 'skip: encoding % unsupported for xpath',
579580
current_setting('server_encoding');
580581
RETURN;
581582
END IF;
@@ -590,15 +591,14 @@ BEGIN
590591
END IF;
591592
EXCEPTION
592593
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
593-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
594+
WHEN untranslatable_character
594595
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
595-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
596+
OR undefined_function
597+
-- unsupported XML feature
598+
OR feature_not_supported THEN
599+
RAISE LOG 'skip: %', SQLERRM;
596600
END
597601
$$;
598-
ERROR: unsupported XML feature
599-
DETAIL: This functionality requires the server to be built with libxml support.
600-
HINT: You need to rebuild PostgreSQL using --with-libxml.
601-
CONTEXT: PL/pgSQL function inline_code_block line 17 at assignment
602602
-- Test xmlexists and xpath_exists
603603
SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns>');
604604
ERROR: unsupported XML feature

src/test/regress/expected/xml_2.out

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,12 @@ DECLARE
642642
degree_symbol text;
643643
res xml[];
644644
BEGIN
645-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
646-
-- the server encoding is not UTF8. The EXCEPTION block below,
647-
-- currently dead code, will be relevant if we remove this limitation.
645+
-- Per the documentation, except when the server encoding is UTF8, xpath()
646+
-- may not work on non-ASCII data. The untranslatable_character and
647+
-- undefined_function traps below, currently dead code, will become relevant
648+
-- if we remove this limitation.
648649
IF current_setting('server_encoding') <> 'UTF8' THEN
649-
RAISE LOG 'skip: encoding % unsupported for xml',
650+
RAISE LOG 'skip: encoding % unsupported for xpath',
650651
current_setting('server_encoding');
651652
RETURN;
652653
END IF;
@@ -661,9 +662,12 @@ BEGIN
661662
END IF;
662663
EXCEPTION
663664
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
664-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
665+
WHEN untranslatable_character
665666
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
666-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
667+
OR undefined_function
668+
-- unsupported XML feature
669+
OR feature_not_supported THEN
670+
RAISE LOG 'skip: %', SQLERRM;
667671
END
668672
$$;
669673
-- Test xmlexists and xpath_exists

src/test/regress/sql/xml.sql

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,12 @@ DECLARE
193193
degree_symbol text;
194194
res xml[];
195195
BEGIN
196-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
197-
-- the server encoding is not UTF8. The EXCEPTION block below,
198-
-- currently dead code, will be relevant if we remove this limitation.
196+
-- Per the documentation, except when the server encoding is UTF8, xpath()
197+
-- may not work on non-ASCII data. The untranslatable_character and
198+
-- undefined_function traps below, currently dead code, will become relevant
199+
-- if we remove this limitation.
199200
IF current_setting('server_encoding') <> 'UTF8' THEN
200-
RAISE LOG 'skip: encoding % unsupported for xml',
201+
RAISE LOG 'skip: encoding % unsupported for xpath',
201202
current_setting('server_encoding');
202203
RETURN;
203204
END IF;
@@ -212,9 +213,12 @@ BEGIN
212213
END IF;
213214
EXCEPTION
214215
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
215-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
216+
WHEN untranslatable_character
216217
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
217-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
218+
OR undefined_function
219+
-- unsupported XML feature
220+
OR feature_not_supported THEN
221+
RAISE LOG 'skip: %', SQLERRM;
218222
END
219223
$$;
220224

0 commit comments

Comments
 (0)