Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix previous commit's test, for non-UTF8 databases with non-XML builds.
authorNoah Misch <noah@leadboat.com>
Sat, 11 Nov 2017 21:07:46 +0000 (13:07 -0800)
committerNoah Misch <noah@leadboat.com>
Sat, 11 Nov 2017 21:07:55 +0000 (13:07 -0800)
To ensure stable output, catch one more configuration-specific error.
Back-patch to 9.3, like the commit that added the test.

src/test/regress/expected/xml.out
src/test/regress/expected/xml_1.out
src/test/regress/expected/xml_2.out
src/test/regress/sql/xml.sql

index 39d94eaf561c57106d8ab935fe8babbdccbe7ea2..1b8f822b187a45f03c6b63f187835f12a2b2f63a 100644 (file)
@@ -660,11 +660,12 @@ DECLARE
   degree_symbol text;
   res xml[];
 BEGIN
-  -- Per the documentation, xpath() doesn't work on non-ASCII data when
-  -- the server encoding is not UTF8.  The EXCEPTION block below,
-  -- currently dead code, will be relevant if we remove this limitation.
+  -- Per the documentation, except when the server encoding is UTF8, xpath()
+  -- may not work on non-ASCII data.  The untranslatable_character and
+  -- undefined_function traps below, currently dead code, will become relevant
+  -- if we remove this limitation.
   IF current_setting('server_encoding') <> 'UTF8' THEN
-    RAISE LOG 'skip: encoding % unsupported for xml',
+    RAISE LOG 'skip: encoding % unsupported for xpath',
       current_setting('server_encoding');
     RETURN;
   END IF;
@@ -679,9 +680,12 @@ BEGIN
   END IF;
 EXCEPTION
   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
-  WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
+  WHEN untranslatable_character
   -- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
-  WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
+  OR undefined_function
+  -- unsupported XML feature
+  OR feature_not_supported THEN
+    RAISE LOG 'skip: %', SQLERRM;
 END
 $$;
 -- Test xmlexists and xpath_exists
index ab136376c28d7d5b291a05518fee561e09614c92..0098d106ea61564a746b33d63100f9c26269ad98 100644 (file)
@@ -571,11 +571,12 @@ DECLARE
   degree_symbol text;
   res xml[];
 BEGIN
-  -- Per the documentation, xpath() doesn't work on non-ASCII data when
-  -- the server encoding is not UTF8.  The EXCEPTION block below,
-  -- currently dead code, will be relevant if we remove this limitation.
+  -- Per the documentation, except when the server encoding is UTF8, xpath()
+  -- may not work on non-ASCII data.  The untranslatable_character and
+  -- undefined_function traps below, currently dead code, will become relevant
+  -- if we remove this limitation.
   IF current_setting('server_encoding') <> 'UTF8' THEN
-    RAISE LOG 'skip: encoding % unsupported for xml',
+    RAISE LOG 'skip: encoding % unsupported for xpath',
       current_setting('server_encoding');
     RETURN;
   END IF;
@@ -590,15 +591,14 @@ BEGIN
   END IF;
 EXCEPTION
   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
-  WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
+  WHEN untranslatable_character
   -- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
-  WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
+  OR undefined_function
+  -- unsupported XML feature
+  OR feature_not_supported THEN
+    RAISE LOG 'skip: %', SQLERRM;
 END
 $$;
-ERROR:  unsupported XML feature
-DETAIL:  This functionality requires the server to be built with libxml support.
-HINT:  You need to rebuild PostgreSQL using --with-libxml.
-CONTEXT:  PL/pgSQL function inline_code_block line 17 at assignment
 -- Test xmlexists and xpath_exists
 SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns>');
 ERROR:  unsupported XML feature
index eb1fd92b3e15156fe4a2bff4e6e4b1efc97384f7..ea68d975d9c3675386b7dd71ab353de0ed3686a2 100644 (file)
@@ -642,11 +642,12 @@ DECLARE
   degree_symbol text;
   res xml[];
 BEGIN
-  -- Per the documentation, xpath() doesn't work on non-ASCII data when
-  -- the server encoding is not UTF8.  The EXCEPTION block below,
-  -- currently dead code, will be relevant if we remove this limitation.
+  -- Per the documentation, except when the server encoding is UTF8, xpath()
+  -- may not work on non-ASCII data.  The untranslatable_character and
+  -- undefined_function traps below, currently dead code, will become relevant
+  -- if we remove this limitation.
   IF current_setting('server_encoding') <> 'UTF8' THEN
-    RAISE LOG 'skip: encoding % unsupported for xml',
+    RAISE LOG 'skip: encoding % unsupported for xpath',
       current_setting('server_encoding');
     RETURN;
   END IF;
@@ -661,9 +662,12 @@ BEGIN
   END IF;
 EXCEPTION
   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
-  WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
+  WHEN untranslatable_character
   -- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
-  WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
+  OR undefined_function
+  -- unsupported XML feature
+  OR feature_not_supported THEN
+    RAISE LOG 'skip: %', SQLERRM;
 END
 $$;
 -- Test xmlexists and xpath_exists
index 62a4736275ff57c9db1549f1611673a2c0f23fbf..249f7b7d8822efa89a9cd1db696b07351eccca01 100644 (file)
@@ -193,11 +193,12 @@ DECLARE
   degree_symbol text;
   res xml[];
 BEGIN
-  -- Per the documentation, xpath() doesn't work on non-ASCII data when
-  -- the server encoding is not UTF8.  The EXCEPTION block below,
-  -- currently dead code, will be relevant if we remove this limitation.
+  -- Per the documentation, except when the server encoding is UTF8, xpath()
+  -- may not work on non-ASCII data.  The untranslatable_character and
+  -- undefined_function traps below, currently dead code, will become relevant
+  -- if we remove this limitation.
   IF current_setting('server_encoding') <> 'UTF8' THEN
-    RAISE LOG 'skip: encoding % unsupported for xml',
+    RAISE LOG 'skip: encoding % unsupported for xpath',
       current_setting('server_encoding');
     RETURN;
   END IF;
@@ -212,9 +213,12 @@ BEGIN
   END IF;
 EXCEPTION
   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8"
-  WHEN untranslatable_character THEN RAISE LOG 'skip: %', SQLERRM;
+  WHEN untranslatable_character
   -- default conversion function for encoding "UTF8" to "MULE_INTERNAL" does not exist
-  WHEN undefined_function THEN RAISE LOG 'skip: %', SQLERRM;
+  OR undefined_function
+  -- unsupported XML feature
+  OR feature_not_supported THEN
+    RAISE LOG 'skip: %', SQLERRM;
 END
 $$;