8000 Fix previous commit's test, for non-UTF8 databases with non-XML builds. · koderP/postgres@739f1f6 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 739f1f6

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 e7083df commit 739f1f6

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
@@ -677,11 +677,12 @@ DECLARE
677677
degree_symbol text;
678678
res xml[];
679679
BEGIN
680-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
681-
-- the server encoding is not UTF8. The EXCEPTION block below,
682-
-- currently dead code, will be relevant if we remove this limitation.
680+
-- Per the documentation, except when the server encoding is UTF8, xpath()
681+
-- may not work on non-ASCII data. The untranslatable_character and
682+
-- undefined_function traps below, currently dead code, will become relevant
683+
-- if we remove this limitation.
683684
IF current_setting('server_encoding') <> 'UTF8' THEN
684-
RAISE LOG 'skip: encoding % unsupported for xml',
685+
RAISE LOG 'skip: encoding % unsupported for xpath',
685686
current_setting('server_encoding');
686687
RETURN;
687688
END IF;
@@ -696,9 +697,12 @@ BEGIN
696697
END IF;
697698
EXCEPTION
698699
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
699-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
700+
WHEN untranslatable_character
700701
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
701-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
702+
OR undefined_function
703+
-- unsupported XML feature
704+
OR feature_not_supported THEN
705+
RAISE LOG 'skip: %', SQLERRM;
702706
END
703707
$$;
704708
-- 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
@@ -583,11 +583,12 @@ DECLARE
583583
degree_symbol text;
584584
res xml[];
585585
BEGIN
586-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
587-
-- the server encoding is not UTF8. The EXCEPTION block below,
588-
-- currently dead code, will be relevant if we remove this limitation.
586+
-- Per the documentation, except when the server encoding is UTF8, xpath()
587+
-- may not work on non-ASCII data. The untranslatable_character and
588+
-- undefined_function traps below, currently dead code, will become relevant
589+
-- if we remove this limitation.
589590
IF current_setting('server_encoding') <> 'UTF8' THEN
590-
RAISE LOG 'skip: encoding % unsupported for xml',
591+
RAISE LOG 'skip: encoding % unsupported for xpath',
591592
current_setting('server_encoding');
592593
RETURN;
593594
END IF;
@@ -602,15 +603,14 @@ BEGIN
602603
END IF;
603604
EXCEPTION
604605
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
605-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
606+
WHEN untranslatable_character
606607
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
607-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
608+
OR undefined_function
609+
-- unsupported XML feature
610+
OR feature_not_supported THEN
611+
RAISE LOG 'skip: %', SQLERRM;
608612
END
609613
$$;
610-
ERROR: unsupported XML feature
611-
DETAIL: This functionality requires the server to be built with libxml support.
612-
HINT: You need to rebuild PostgreSQL using --with-libxml.
613-
CONTEXT: PL/pgSQL function inline_code_block line 17 at assignment
614614
-- Test xmlexists and xpath_exists
615615
SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns>');
616616
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
@@ -657,11 +657,12 @@ DECLARE
657657
degree_symbol text;
658658
res xml[];
659659
BEGIN
660-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
661-
-- the server encoding is not UTF8. The EXCEPTION block below,
662-
-- currently dead code, will be relevant if we remove this limitation.
660+
-- Per the documentation, except when the server encoding is UTF8, xpath()
661+
-- may not work on non-ASCII data. The untranslatable_character and
662+
-- undefined_function traps below, currently dead code, will become relevant
663+
-- if we remove this limitation.
663664
IF current_setting('server_encoding') <> 'UTF8' THEN
664-
RAISE LOG 'skip: encoding % unsupported for xml',
665+
RAISE LOG 'skip: encoding % unsupported for xpath',
665666
current_setting('server_encoding');
666667
RETURN;
667668
END IF;
@@ -676,9 +677,12 @@ BEGIN
676677
END IF;
677678
EXCEPTION
678679
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
679-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
680+
WHEN untranslatable_character
680681
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
681-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
682+
OR undefined_function
683+
-- unsupported XML feature
684+
OR feature_not_supported THEN
685+
RAISE LOG 'skip: %', SQLERRM;
682686
END
683687
$$;
684688
-- 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
@@ -196,11 +196,12 @@ DECLARE
196196
degree_symbol text;
197197
res xml[];
198198
BEGIN
199-
-- Per the documentation, xpath() doesn't work on non-ASCII data when
200-
-- the server encoding is not UTF8. The EXCEPTION block below,
201-
-- currently dead code, will be relevant if we remove this limitation.
199+
-- Per the documentation, except when the server encoding is UTF8, xpath()
200+
-- may not work on non-ASCII data. The untranslatable_character and
201+
-- undefined_function traps below, currently dead code, will become relevant
202+
-- if we remove this limitation.
202203
IF current_setting('server_encoding') <> 'UTF8' THEN
203-
RAISE LOG 'skip: encoding % unsupported for xml',
204+
RAISE LOG 'skip: encoding % unsupported for xpath',
204205
current_setting('server_encoding');
205206
RETURN;
206207
END IF;
@@ -215,9 +216,12 @@ BEGIN
215216
END IF;
216217
EXCEPTION
217218
-- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
218-
WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
219+
WHEN untranslatable_character
219220
-- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
220-
WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
221+
OR undefined_function
222+
-- unsupported XML feature
223+
OR feature_not_supported THEN
224+
RAISE LOG 'skip: %', SQLERRM;
221225
END
222226
$$;
223227

0 commit comments

Comments
 (0)
0