mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-28 11:55:03 +03:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -677,11 +677,12 @@ DECLARE | |||||||
|   degree_symbol text; |   degree_symbol text; | ||||||
|   res xml[]; |   res xml[]; | ||||||
| BEGIN | BEGIN | ||||||
|   -- Per the documentation, xpath() doesn't work on non-ASCII data when |   -- Per the documentation, except when the server encoding is UTF8, xpath() | ||||||
|   -- the server encoding is not UTF8.  The EXCEPTION block below, |   -- may not work on non-ASCII data.  The untranslatable_character and | ||||||
|   -- currently dead code, will be relevant if we remove this limitation. |   -- undefined_function traps below, currently dead code, will become relevant | ||||||
|  |   -- if we remove this limitation. | ||||||
|   IF current_setting('server_encoding') <> 'UTF8' THEN |   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'); |       current_setting('server_encoding'); | ||||||
|     RETURN; |     RETURN; | ||||||
|   END IF; |   END IF; | ||||||
| @@ -696,9 +697,12 @@ BEGIN | |||||||
|   END IF; |   END IF; | ||||||
| EXCEPTION | EXCEPTION | ||||||
|   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8" |   -- 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 |   -- 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 | END | ||||||
| $$; | $$; | ||||||
| -- Test xmlexists and xpath_exists | -- Test xmlexists and xpath_exists | ||||||
|   | |||||||
| @@ -583,11 +583,12 @@ DECLARE | |||||||
|   degree_symbol text; |   degree_symbol text; | ||||||
|   res xml[]; |   res xml[]; | ||||||
| BEGIN | BEGIN | ||||||
|   -- Per the documentation, xpath() doesn't work on non-ASCII data when |   -- Per the documentation, except when the server encoding is UTF8, xpath() | ||||||
|   -- the server encoding is not UTF8.  The EXCEPTION block below, |   -- may not work on non-ASCII data.  The untranslatable_character and | ||||||
|   -- currently dead code, will be relevant if we remove this limitation. |   -- undefined_function traps below, currently dead code, will become relevant | ||||||
|  |   -- if we remove this limitation. | ||||||
|   IF current_setting('server_encoding') <> 'UTF8' THEN |   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'); |       current_setting('server_encoding'); | ||||||
|     RETURN; |     RETURN; | ||||||
|   END IF; |   END IF; | ||||||
| @@ -602,15 +603,14 @@ BEGIN | |||||||
|   END IF; |   END IF; | ||||||
| EXCEPTION | EXCEPTION | ||||||
|   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8" |   -- 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 |   -- 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 | 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 | -- 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>'); | 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 | ERROR:  unsupported XML feature | ||||||
|   | |||||||
| @@ -657,11 +657,12 @@ DECLARE | |||||||
|   degree_symbol text; |   degree_symbol text; | ||||||
|   res xml[]; |   res xml[]; | ||||||
| BEGIN | BEGIN | ||||||
|   -- Per the documentation, xpath() doesn't work on non-ASCII data when |   -- Per the documentation, except when the server encoding is UTF8, xpath() | ||||||
|   -- the server encoding is not UTF8.  The EXCEPTION block below, |   -- may not work on non-ASCII data.  The untranslatable_character and | ||||||
|   -- currently dead code, will be relevant if we remove this limitation. |   -- undefined_function traps below, currently dead code, will become relevant | ||||||
|  |   -- if we remove this limitation. | ||||||
|   IF current_setting('server_encoding') <> 'UTF8' THEN |   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'); |       current_setting('server_encoding'); | ||||||
|     RETURN; |     RETURN; | ||||||
|   END IF; |   END IF; | ||||||
| @@ -676,9 +677,12 @@ BEGIN | |||||||
|   END IF; |   END IF; | ||||||
| EXCEPTION | EXCEPTION | ||||||
|   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8" |   -- 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 |   -- 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 | END | ||||||
| $$; | $$; | ||||||
| -- Test xmlexists and xpath_exists | -- Test xmlexists and xpath_exists | ||||||
|   | |||||||
| @@ -196,11 +196,12 @@ DECLARE | |||||||
|   degree_symbol text; |   degree_symbol text; | ||||||
|   res xml[]; |   res xml[]; | ||||||
| BEGIN | BEGIN | ||||||
|   -- Per the documentation, xpath() doesn't work on non-ASCII data when |   -- Per the documentation, except when the server encoding is UTF8, xpath() | ||||||
|   -- the server encoding is not UTF8.  The EXCEPTION block below, |   -- may not work on non-ASCII data.  The untranslatable_character and | ||||||
|   -- currently dead code, will be relevant if we remove this limitation. |   -- undefined_function traps below, currently dead code, will become relevant | ||||||
|  |   -- if we remove this limitation. | ||||||
|   IF current_setting('server_encoding') <> 'UTF8' THEN |   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'); |       current_setting('server_encoding'); | ||||||
|     RETURN; |     RETURN; | ||||||
|   END IF; |   END IF; | ||||||
| @@ -215,9 +216,12 @@ BEGIN | |||||||
|   END IF; |   END IF; | ||||||
| EXCEPTION | EXCEPTION | ||||||
|   -- character with byte sequence 0xc2 0xb0 in encoding "UTF8" has no equivalent in encoding "LATIN8" |   -- 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 |   -- 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 | END | ||||||
| $$; | $$; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user