Commit 419400c5 authored by Tom Lane's avatar Tom Lane

Remove some ancient and unmaintained encoding-conversion test cruft.

In commit 92119191 I claimed that we weren't testing encoding
conversion functions, but further poking around reveals that we did
have an equivalent though hard-wired set of tests in conversion.sql.
AFAICS there is no advantage to doing it like that as compared to letting
the catalog contents drive the test, so let the opr_sanity addition stand
and remove the now-redundant tests in conversion.sql.

Also, remove some infrastructure in src/backend/utils/mb/conversion_procs
for building conversion.sql's list of tests.  That was unmaintained, and
had not corresponded to the actual contents of conversion.sql since 2007
or perhaps even further back.
parent 3343ea9e
......@@ -14,9 +14,6 @@ include $(top_builddir)/src/Makefile.global
SQLSCRIPT = conversion_create.sql
# This file can be placed as src/test/regress/sql/conversion.sql
REGRESSION_SCRIPT = conversion.sql
SUBDIRS = \
ascii_and_mic cyrillic_and_mic euc_cn_and_mic euc_jp_and_sjis \
euc_kr_and_mic euc_tw_and_big5 latin2_and_win1250 latin_and_mic \
......@@ -184,23 +181,6 @@ $(SQLSCRIPT): Makefile
echo; \
done > $@
$(REGRESSION_SCRIPT): Makefile
@set -e; \
cp regress_prolog $@; \
set $(CONVERSIONS) ; \
while [ "$$#" -gt 0 ] ; \
do \
name=$$1;shift; \
se=$$1;shift; \
de=$$1; shift; \
func=$$1; shift; \
obj=$$1; shift; \
echo "-- $$se --> $$de"; \
echo "SELECT CONVERT('foo' USING $$name);"; \
echo "SELECT CONVERT('foo', '$$se', '$$de');"; \
done >> $@; \
cat regress_epilogue >> $@;
install: $(SQLSCRIPT) installdirs
$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
......
--
-- return to the super user
--
RESET SESSION AUTHORIZATION;
DROP USER conversion_test_user;
--
-- create user defined conversion
--
CREATE USER conversion_test_user WITH NOCREATEDB NOCREATEROLE;
SET SESSION AUTHORIZATION conversion_test_user;
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- cannot make same name conversion in same schema
--
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- create default conversion with qualified name
--
CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- cannot make default conversion with same shcema/for_encoding/to_encoding
--
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- drop user defined conversion
--
DROP CONVERSION myconv;
DROP CONVERSION mydef;
--
-- make sure all pre-defined conversions are fine.
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
--
-- create user defined conversion
--
......@@ -16,7 +14,7 @@ ERROR: conversion "myconv" already exists
--
CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- cannot make default conversion with same shcema/for_encoding/to_encoding
-- cannot make default conversion with same schema/for_encoding/to_encoding
--
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
ERROR: default conversion for LATIN1 to UTF8 already exists
......@@ -31,917 +29,9 @@ COMMENT ON CONVERSION myconv IS NULL;
DROP CONVERSION myconv;
DROP CONVERSION mydef;
--
-- make sure all pre-defined conversions are fine.
-- SQL_ASCII --> MULE_INTERNAL
SELECT CONVERT('foo', 'SQL_ASCII', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> SQL_ASCII
SELECT CONVERT('foo', 'MULE_INTERNAL', 'SQL_ASCII');
convert
---------
foo
(1 row)
-- KOI8R --> MULE_INTERNAL
SELECT CONVERT('foo', 'KOI8R', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> KOI8R
SELECT CONVERT('foo', 'MULE_INTERNAL', 'KOI8R');
convert
---------
foo
(1 row)
-- ISO-8859-5 --> MULE_INTERNAL
SELECT CONVERT('foo', 'ISO-8859-5', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> ISO-8859-5
SELECT CONVERT('foo', 'MULE_INTERNAL', 'ISO-8859-5');
convert
---------
foo
(1 row)
-- WIN1251 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN1251', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> WIN1251
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1251');
convert
---------
foo
(1 row)
-- WIN866 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN866', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> WIN866
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN866');
convert
---------
foo
(1 row)
-- KOI8R --> WIN1251
SELECT CONVERT('foo', 'KOI8R', 'WIN1251');
convert
---------
foo
(1 row)
-- WIN1251 --> KOI8R
SELECT CONVERT('foo', 'WIN1251', 'KOI8R');
convert
---------
foo
(1 row)
-- KOI8R --> WIN866
SELECT CONVERT('foo', 'KOI8R', 'WIN866');
convert
---------
foo
(1 row)
-- WIN866 --> KOI8R
SELECT CONVERT('foo', 'WIN866', 'KOI8R');
convert
---------
foo
(1 row)
-- WIN866 --> WIN1251
SELECT CONVERT('foo', 'WIN866', 'WIN1251');
convert
---------
foo
(1 row)
-- WIN1251 --> WIN866
SELECT CONVERT('foo', 'WIN1251', 'WIN866');
convert
---------
foo
(1 row)
-- ISO-8859-5 --> KOI8R
SELECT CONVERT('foo', 'ISO-8859-5', 'KOI8R');
convert
---------
foo
(1 row)
-- KOI8R --> ISO-8859-5
SELECT CONVERT('foo', 'KOI8R', 'ISO-8859-5');
convert
---------
foo
(1 row)
-- ISO-8859-5 --> WIN1251
SELECT CONVERT('foo', 'ISO-8859-5', 'WIN1251');
convert
---------
foo
(1 row)
-- WIN1251 --> ISO-8859-5
SELECT CONVERT('foo', 'WIN1251', 'ISO-8859-5');
convert
---------
foo
(1 row)
-- ISO-8859-5 --> WIN866
SELECT CONVERT('foo', 'ISO-8859-5', 'WIN866');
convert
---------
foo
(1 row)
-- WIN866 --> ISO-8859-5
SELECT CONVERT('foo', 'WIN866', 'ISO-8859-5');
convert
---------
foo
(1 row)
-- EUC_CN --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_CN', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> EUC_CN
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_CN');
convert
---------
foo
(1 row)
-- EUC_JP --> SJIS
SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
convert
---------
foo
(1 row)
-- SJIS --> EUC_JP
SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
convert
---------
foo
(1 row)
-- EUC_JP --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- SJIS --> MULE_INTERNAL
SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> EUC_JP
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> SJIS
SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
convert
---------
foo
(1 row)
-- EUC_KR --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_KR', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> EUC_KR
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_KR');
convert
---------
foo
(1 row)
-- EUC_TW --> BIG5
SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
convert
---------
foo
(1 row)
-- BIG5 --> EUC_TW
SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
convert
---------
foo
(1 row)
-- EUC_TW --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- BIG5 --> MULE_INTERNAL
SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> EUC_TW
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> BIG5
SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
convert
---------
foo
(1 row)
-- LATIN2 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN2', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> LATIN2
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN2');
convert
---------
foo
(1 row)
-- WIN1250 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN1250', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> WIN1250
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1250');
convert
---------
foo
(1 row)
-- LATIN2 --> WIN1250
SELECT CONVERT('foo', 'LATIN2', 'WIN1250');
convert
---------
foo
(1 row)
-- WIN1250 --> LATIN2
SELECT CONVERT('foo', 'WIN1250', 'LATIN2');
convert
---------
foo
(1 row)
-- LATIN1 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN1', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> LATIN1
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN1');
convert
---------
foo
(1 row)
-- LATIN3 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN3', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> LATIN3
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN3');
convert
---------
foo
(1 row)
-- LATIN4 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN4', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-- MULE_INTERNAL --> LATIN4
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN4');
convert
---------
foo
(1 row)
-- SQL_ASCII --> UTF8
SELECT CONVERT('foo', 'SQL_ASCII', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> SQL_ASCII
SELECT CONVERT('foo', 'UTF8', 'SQL_ASCII');
convert
---------
foo
(1 row)
-- BIG5 --> UTF8
SELECT CONVERT('foo', 'BIG5', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> BIG5
SELECT CONVERT('foo', 'UTF8', 'BIG5');
convert
---------
foo
(1 row)
-- UTF8 --> KOI8R
SELECT CONVERT('foo', 'UTF8', 'KOI8R');
convert
---------
foo
(1 row)
-- KOI8R --> UTF8
SELECT CONVERT('foo', 'KOI8R', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1251
SELECT CONVERT('foo', 'UTF8', 'WIN1251');
convert
---------
foo
(1 row)
-- WIN1251 --> UTF8
SELECT CONVERT('foo', 'WIN1251', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1252
SELECT CONVERT('foo', 'UTF8', 'WIN1252');
convert
---------
foo
(1 row)
-- WIN1252 --> UTF8
SELECT CONVERT('foo', 'WIN1252', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN866
SELECT CONVERT('foo', 'UTF8', 'WIN866');
convert
---------
foo
(1 row)
-- WIN866 --> UTF8
SELECT CONVERT('foo', 'WIN866', 'UTF8');
convert
---------
foo
(1 row)
-- EUC_CN --> UTF8
SELECT CONVERT('foo', 'EUC_CN', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> EUC_CN
SELECT CONVERT('foo', 'UTF8', 'EUC_CN');
convert
---------
foo
(1 row)
-- EUC_JP --> UTF8
SELECT CONVERT('foo', 'EUC_JP', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> EUC_JP
SELECT CONVERT('foo', 'UTF8', 'EUC_JP');
convert
---------
foo
(1 row)
-- EUC_KR --> UTF8
SELECT CONVERT('foo', 'EUC_KR', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> EUC_KR
SELECT CONVERT('foo', 'UTF8', 'EUC_KR');
convert
---------
foo
(1 row)
-- EUC_TW --> UTF8
SELECT CONVERT('foo', 'EUC_TW', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> EUC_TW
SELECT CONVERT('foo', 'UTF8', 'EUC_TW');
convert
---------
foo
(1 row)
-- GB18030 --> UTF8
SELECT CONVERT('Postgres \247\343\247\335\247\340\247\337 \2249\3138 \317\363 \250\246le\2010\2747phant', 'GB18030', 'UTF8');
convert
-------------------------------------------------------------------------------------------------
Postgres \321\201\320\273\320\276\320\275 \360\237\220\230 \350\261\241 \303\251le\314\201phant
(1 row)
-- UTF8 --> GB18030
SELECT CONVERT('Postgres \321\201\320\273\320\276\320\275 \360\237\220\230 \350\261\241 \303\251le\314\201phant', 'UTF-8', 'GB18030');
convert
-----------------------------------------------------------------------------------------
Postgres \247\343\247\335\247\340\247\337 \2249\3138 \317\363 \250\246le\2010\2747phant
(1 row)
-- GBK --> UTF8
SELECT CONVERT('foo', 'GBK', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> GBK
SELECT CONVERT('foo', 'UTF8', 'GBK');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN2
SELECT CONVERT('foo', 'UTF8', 'LATIN2');
convert
---------
foo
(1 row)
-- LATIN2 --> UTF8
SELECT CONVERT('foo', 'LATIN2', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN3
SELECT CONVERT('foo', 'UTF8', 'LATIN3');
convert
---------
foo
(1 row)
-- LATIN3 --> UTF8
SELECT CONVERT('foo', 'LATIN3', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN4
SELECT CONVERT('foo', 'UTF8', 'LATIN4');
convert
---------
foo
(1 row)
-- LATIN4 --> UTF8
SELECT CONVERT('foo', 'LATIN4', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN5
SELECT CONVERT('foo', 'UTF8', 'LATIN5');
convert
---------
foo
(1 row)
-- LATIN5 --> UTF8
SELECT CONVERT('foo', 'LATIN5', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN6
SELECT CONVERT('foo', 'UTF8', 'LATIN6');
convert
---------
foo
(1 row)
-- LATIN6 --> UTF8
SELECT CONVERT('foo', 'LATIN6', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN7
SELECT CONVERT('foo', 'UTF8', 'LATIN7');
convert
---------
foo
(1 row)
-- LATIN7 --> UTF8
SELECT CONVERT('foo', 'LATIN7', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN8
SELECT CONVERT('foo', 'UTF8', 'LATIN8');
convert
---------
foo
(1 row)
-- LATIN8 --> UTF8
SELECT CONVERT('foo', 'LATIN8', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN9
SELECT CONVERT('foo', 'UTF8', 'LATIN9');
convert
---------
foo
(1 row)
-- LATIN9 --> UTF8
SELECT CONVERT('foo', 'LATIN9', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN10
SELECT CONVERT('foo', 'UTF8', 'LATIN10');
convert
---------
foo
(1 row)
-- LATIN10 --> UTF8
SELECT CONVERT('foo', 'LATIN10', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> ISO-8859-5
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-5');
convert
---------
foo
(1 row)
-- ISO-8859-5 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-5', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> ISO-8859-6
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-6');
convert
---------
foo
(1 row)
-- ISO-8859-6 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-6', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> ISO-8859-7
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-7');
convert
---------
foo
(1 row)
-- ISO-8859-7 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-7', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> ISO-8859-8
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-8');
convert
---------
foo
(1 row)
-- ISO-8859-8 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-8', 'UTF8');
convert
---------
foo
(1 row)
-- LATIN1 --> UTF8
SELECT CONVERT('foo', 'LATIN1', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> LATIN1
SELECT CONVERT('foo', 'UTF8', 'LATIN1');
convert
---------
foo
(1 row)
-- JOHAB --> UTF8
SELECT CONVERT('foo', 'JOHAB', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> JOHAB
SELECT CONVERT('foo', 'UTF8', 'JOHAB');
convert
---------
foo
(1 row)
-- SJIS --> UTF8
SELECT CONVERT('foo', 'SJIS', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> SJIS
SELECT CONVERT('foo', 'UTF8', 'SJIS');
convert
---------
foo
(1 row)
-- WIN1258 --> UTF8
SELECT CONVERT('foo', 'WIN1258', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1258
SELECT CONVERT('foo', 'UTF8', 'WIN1258');
convert
---------
foo
(1 row)
-- UHC --> UTF8
SELECT CONVERT('foo', 'UHC', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> UHC
SELECT CONVERT('foo', 'UTF8', 'UHC');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1250
SELECT CONVERT('foo', 'UTF8', 'WIN1250');
convert
---------
foo
(1 row)
-- WIN1250 --> UTF8
SELECT CONVERT('foo', 'WIN1250', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1256
SELECT CONVERT('foo', 'UTF8', 'WIN1256');
convert
---------
foo
(1 row)
-- WIN1256 --> UTF8
SELECT CONVERT('foo', 'WIN1256', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN874
SELECT CONVERT('foo', 'UTF8', 'WIN874');
convert
---------
foo
(1 row)
-- WIN874 --> UTF8
SELECT CONVERT('foo', 'WIN874', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1253
SELECT CONVERT('foo', 'UTF8', 'WIN1253');
convert
---------
foo
(1 row)
-- WIN1253 --> UTF8
SELECT CONVERT('foo', 'WIN1253', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1254
SELECT CONVERT('foo', 'UTF8', 'WIN1254');
convert
---------
foo
(1 row)
-- WIN1254 --> UTF8
SELECT CONVERT('foo', 'WIN1254', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1255
SELECT CONVERT('foo', 'UTF8', 'WIN1255');
convert
---------
foo
(1 row)
-- WIN1255 --> UTF8
SELECT CONVERT('foo', 'WIN1255', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> WIN1257
SELECT CONVERT('foo', 'UTF8', 'WIN1257');
convert
---------
foo
(1 row)
-- WIN1257 --> UTF8
SELECT CONVERT('foo', 'WIN1257', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> EUC_JIS_2004
SELECT CONVERT('foo', 'UTF8', 'EUC_JIS_2004');
convert
---------
foo
(1 row)
-- EUC_JIS_2004 --> UTF8
SELECT CONVERT('foo', 'EUC_JIS_2004', 'UTF8');
convert
---------
foo
(1 row)
-- UTF8 --> SHIFT_JIS_2004
SELECT CONVERT('foo', 'UTF8', 'SHIFT_JIS_2004');
convert
---------
foo
(1 row)
-- SHIFT_JIS_2004 --> UTF8
SELECT CONVERT('foo', 'SHIFT_JIS_2004', 'UTF8');
convert
---------
foo
(1 row)
-- EUC_JIS_2004 --> SHIFT_JIS_2004
SELECT CONVERT('foo', 'EUC_JIS_2004', 'SHIFT_JIS_2004');
convert
---------
foo
(1 row)
-- SHIFT_JIS_2004 --> EUC_JIS_2004
SELECT CONVERT('foo', 'SHIFT_JIS_2004', 'EUC_JIS_2004');
convert
---------
foo
(1 row)
-- Note: the built-in conversions are exercised in opr_sanity.sql,
-- so there's no need to do that here.
--
--
-- return to the super user
--
......
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
--
-- create user defined conversion
--
......@@ -16,7 +13,7 @@ CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
--
-- cannot make default conversion with same shcema/for_encoding/to_encoding
-- cannot make default conversion with same schema/for_encoding/to_encoding
--
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
-- test comments
......@@ -29,267 +26,9 @@ COMMENT ON CONVERSION myconv IS NULL;
DROP CONVERSION myconv;
DROP CONVERSION mydef;
--
-- make sure all pre-defined conversions are fine.
-- SQL_ASCII --> MULE_INTERNAL
SELECT CONVERT('foo', 'SQL_ASCII', 'MULE_INTERNAL');
-- MULE_INTERNAL --> SQL_ASCII
SELECT CONVERT('foo', 'MULE_INTERNAL', 'SQL_ASCII');
-- KOI8R --> MULE_INTERNAL
SELECT CONVERT('foo', 'KOI8R', 'MULE_INTERNAL');
-- MULE_INTERNAL --> KOI8R
SELECT CONVERT('foo', 'MULE_INTERNAL', 'KOI8R');
-- ISO-8859-5 --> MULE_INTERNAL
SELECT CONVERT('foo', 'ISO-8859-5', 'MULE_INTERNAL');
-- MULE_INTERNAL --> ISO-8859-5
SELECT CONVERT('foo', 'MULE_INTERNAL', 'ISO-8859-5');
-- WIN1251 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN1251', 'MULE_INTERNAL');
-- MULE_INTERNAL --> WIN1251
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1251');
-- WIN866 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN866', 'MULE_INTERNAL');
-- MULE_INTERNAL --> WIN866
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN866');
-- KOI8R --> WIN1251
SELECT CONVERT('foo', 'KOI8R', 'WIN1251');
-- WIN1251 --> KOI8R
SELECT CONVERT('foo', 'WIN1251', 'KOI8R');
-- KOI8R --> WIN866
SELECT CONVERT('foo', 'KOI8R', 'WIN866');
-- WIN866 --> KOI8R
SELECT CONVERT('foo', 'WIN866', 'KOI8R');
-- WIN866 --> WIN1251
SELECT CONVERT('foo', 'WIN866', 'WIN1251');
-- WIN1251 --> WIN866
SELECT CONVERT('foo', 'WIN1251', 'WIN866');
-- ISO-8859-5 --> KOI8R
SELECT CONVERT('foo', 'ISO-8859-5', 'KOI8R');
-- KOI8R --> ISO-8859-5
SELECT CONVERT('foo', 'KOI8R', 'ISO-8859-5');
-- ISO-8859-5 --> WIN1251
SELECT CONVERT('foo', 'ISO-8859-5', 'WIN1251');
-- WIN1251 --> ISO-8859-5
SELECT CONVERT('foo', 'WIN1251', 'ISO-8859-5');
-- ISO-8859-5 --> WIN866
SELECT CONVERT('foo', 'ISO-8859-5', 'WIN866');
-- WIN866 --> ISO-8859-5
SELECT CONVERT('foo', 'WIN866', 'ISO-8859-5');
-- EUC_CN --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_CN', 'MULE_INTERNAL');
-- MULE_INTERNAL --> EUC_CN
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_CN');
-- EUC_JP --> SJIS
SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
-- SJIS --> EUC_JP
SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
-- EUC_JP --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
-- SJIS --> MULE_INTERNAL
SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
-- MULE_INTERNAL --> EUC_JP
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
-- MULE_INTERNAL --> SJIS
SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
-- EUC_KR --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_KR', 'MULE_INTERNAL');
-- MULE_INTERNAL --> EUC_KR
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_KR');
-- EUC_TW --> BIG5
SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
-- BIG5 --> EUC_TW
SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
-- EUC_TW --> MULE_INTERNAL
SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
-- BIG5 --> MULE_INTERNAL
SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
-- MULE_INTERNAL --> EUC_TW
SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
-- MULE_INTERNAL --> BIG5
SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
-- LATIN2 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN2', 'MULE_INTERNAL');
-- MULE_INTERNAL --> LATIN2
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN2');
-- WIN1250 --> MULE_INTERNAL
SELECT CONVERT('foo', 'WIN1250', 'MULE_INTERNAL');
-- MULE_INTERNAL --> WIN1250
SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1250');
-- LATIN2 --> WIN1250
SELECT CONVERT('foo', 'LATIN2', 'WIN1250');
-- WIN1250 --> LATIN2
SELECT CONVERT('foo', 'WIN1250', 'LATIN2');
-- LATIN1 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN1', 'MULE_INTERNAL');
-- MULE_INTERNAL --> LATIN1
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN1');
-- LATIN3 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN3', 'MULE_INTERNAL');
-- MULE_INTERNAL --> LATIN3
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN3');
-- LATIN4 --> MULE_INTERNAL
SELECT CONVERT('foo', 'LATIN4', 'MULE_INTERNAL');
-- MULE_INTERNAL --> LATIN4
SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN4');
-- SQL_ASCII --> UTF8
SELECT CONVERT('foo', 'SQL_ASCII', 'UTF8');
-- UTF8 --> SQL_ASCII
SELECT CONVERT('foo', 'UTF8', 'SQL_ASCII');
-- BIG5 --> UTF8
SELECT CONVERT('foo', 'BIG5', 'UTF8');
-- UTF8 --> BIG5
SELECT CONVERT('foo', 'UTF8', 'BIG5');
-- UTF8 --> KOI8R
SELECT CONVERT('foo', 'UTF8', 'KOI8R');
-- KOI8R --> UTF8
SELECT CONVERT('foo', 'KOI8R', 'UTF8');
-- UTF8 --> WIN1251
SELECT CONVERT('foo', 'UTF8', 'WIN1251');
-- WIN1251 --> UTF8
SELECT CONVERT('foo', 'WIN1251', 'UTF8');
-- UTF8 --> WIN1252
SELECT CONVERT('foo', 'UTF8', 'WIN1252');
-- WIN1252 --> UTF8
SELECT CONVERT('foo', 'WIN1252', 'UTF8');
-- UTF8 --> WIN866
SELECT CONVERT('foo', 'UTF8', 'WIN866');
-- WIN866 --> UTF8
SELECT CONVERT('foo', 'WIN866', 'UTF8');
-- EUC_CN --> UTF8
SELECT CONVERT('foo', 'EUC_CN', 'UTF8');
-- UTF8 --> EUC_CN
SELECT CONVERT('foo', 'UTF8', 'EUC_CN');
-- EUC_JP --> UTF8
SELECT CONVERT('foo', 'EUC_JP', 'UTF8');
-- UTF8 --> EUC_JP
SELECT CONVERT('foo', 'UTF8', 'EUC_JP');
-- EUC_KR --> UTF8
SELECT CONVERT('foo', 'EUC_KR', 'UTF8');
-- UTF8 --> EUC_KR
SELECT CONVERT('foo', 'UTF8', 'EUC_KR');
-- EUC_TW --> UTF8
SELECT CONVERT('foo', 'EUC_TW', 'UTF8');
-- UTF8 --> EUC_TW
SELECT CONVERT('foo', 'UTF8', 'EUC_TW');
-- GB18030 --> UTF8
SELECT CONVERT('Postgres \247\343\247\335\247\340\247\337 \2249\3138 \317\363 \250\246le\2010\2747phant', 'GB18030', 'UTF8');
-- UTF8 --> GB18030
SELECT CONVERT('Postgres \321\201\320\273\320\276\320\275 \360\237\220\230 \350\261\241 \303\251le\314\201phant', 'UTF-8', 'GB18030');
-- GBK --> UTF8
SELECT CONVERT('foo', 'GBK', 'UTF8');
-- UTF8 --> GBK
SELECT CONVERT('foo', 'UTF8', 'GBK');
-- UTF8 --> LATIN2
SELECT CONVERT('foo', 'UTF8', 'LATIN2');
-- LATIN2 --> UTF8
SELECT CONVERT('foo', 'LATIN2', 'UTF8');
-- UTF8 --> LATIN3
SELECT CONVERT('foo', 'UTF8', 'LATIN3');
-- LATIN3 --> UTF8
SELECT CONVERT('foo', 'LATIN3', 'UTF8');
-- UTF8 --> LATIN4
SELECT CONVERT('foo', 'UTF8', 'LATIN4');
-- LATIN4 --> UTF8
SELECT CONVERT('foo', 'LATIN4', 'UTF8');
-- UTF8 --> LATIN5
SELECT CONVERT('foo', 'UTF8', 'LATIN5');
-- LATIN5 --> UTF8
SELECT CONVERT('foo', 'LATIN5', 'UTF8');
-- UTF8 --> LATIN6
SELECT CONVERT('foo', 'UTF8', 'LATIN6');
-- LATIN6 --> UTF8
SELECT CONVERT('foo', 'LATIN6', 'UTF8');
-- UTF8 --> LATIN7
SELECT CONVERT('foo', 'UTF8', 'LATIN7');
-- LATIN7 --> UTF8
SELECT CONVERT('foo', 'LATIN7', 'UTF8');
-- UTF8 --> LATIN8
SELECT CONVERT('foo', 'UTF8', 'LATIN8');
-- LATIN8 --> UTF8
SELECT CONVERT('foo', 'LATIN8', 'UTF8');
-- UTF8 --> LATIN9
SELECT CONVERT('foo', 'UTF8', 'LATIN9');
-- LATIN9 --> UTF8
SELECT CONVERT('foo', 'LATIN9', 'UTF8');
-- UTF8 --> LATIN10
SELECT CONVERT('foo', 'UTF8', 'LATIN10');
-- LATIN10 --> UTF8
SELECT CONVERT('foo', 'LATIN10', 'UTF8');
-- UTF8 --> ISO-8859-5
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-5');
-- ISO-8859-5 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-5', 'UTF8');
-- UTF8 --> ISO-8859-6
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-6');
-- ISO-8859-6 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-6', 'UTF8');
-- UTF8 --> ISO-8859-7
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-7');
-- ISO-8859-7 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-7', 'UTF8');
-- UTF8 --> ISO-8859-8
SELECT CONVERT('foo', 'UTF8', 'ISO-8859-8');
-- ISO-8859-8 --> UTF8
SELECT CONVERT('foo', 'ISO-8859-8', 'UTF8');
-- LATIN1 --> UTF8
SELECT CONVERT('foo', 'LATIN1', 'UTF8');
-- UTF8 --> LATIN1
SELECT CONVERT('foo', 'UTF8', 'LATIN1');
-- JOHAB --> UTF8
SELECT CONVERT('foo', 'JOHAB', 'UTF8');
-- UTF8 --> JOHAB
SELECT CONVERT('foo', 'UTF8', 'JOHAB');
-- SJIS --> UTF8
SELECT CONVERT('foo', 'SJIS', 'UTF8');
-- UTF8 --> SJIS
SELECT CONVERT('foo', 'UTF8', 'SJIS');
-- WIN1258 --> UTF8
SELECT CONVERT('foo', 'WIN1258', 'UTF8');
-- UTF8 --> WIN1258
SELECT CONVERT('foo', 'UTF8', 'WIN1258');
-- UHC --> UTF8
SELECT CONVERT('foo', 'UHC', 'UTF8');
-- UTF8 --> UHC
SELECT CONVERT('foo', 'UTF8', 'UHC');
-- UTF8 --> WIN1250
SELECT CONVERT('foo', 'UTF8', 'WIN1250');
-- WIN1250 --> UTF8
SELECT CONVERT('foo', 'WIN1250', 'UTF8');
-- UTF8 --> WIN1256
SELECT CONVERT('foo', 'UTF8', 'WIN1256');
-- WIN1256 --> UTF8
SELECT CONVERT('foo', 'WIN1256', 'UTF8');
-- UTF8 --> WIN874
SELECT CONVERT('foo', 'UTF8', 'WIN874');
-- WIN874 --> UTF8
SELECT CONVERT('foo', 'WIN874', 'UTF8');
-- UTF8 --> WIN1253
SELECT CONVERT('foo', 'UTF8', 'WIN1253');
-- WIN1253 --> UTF8
SELECT CONVERT('foo', 'WIN1253', 'UTF8');
-- UTF8 --> WIN1254
SELECT CONVERT('foo', 'UTF8', 'WIN1254');
-- WIN1254 --> UTF8
SELECT CONVERT('foo', 'WIN1254', 'UTF8');
-- UTF8 --> WIN1255
SELECT CONVERT('foo', 'UTF8', 'WIN1255');
-- WIN1255 --> UTF8
SELECT CONVERT('foo', 'WIN1255', 'UTF8');
-- UTF8 --> WIN1257
SELECT CONVERT('foo', 'UTF8', 'WIN1257');
-- WIN1257 --> UTF8
SELECT CONVERT('foo', 'WIN1257', 'UTF8');
-- UTF8 --> EUC_JIS_2004
SELECT CONVERT('foo', 'UTF8', 'EUC_JIS_2004');
-- EUC_JIS_2004 --> UTF8
SELECT CONVERT('foo', 'EUC_JIS_2004', 'UTF8');
-- UTF8 --> SHIFT_JIS_2004
SELECT CONVERT('foo', 'UTF8', 'SHIFT_JIS_2004');
-- SHIFT_JIS_2004 --> UTF8
SELECT CONVERT('foo', 'SHIFT_JIS_2004', 'UTF8');
-- EUC_JIS_2004 --> SHIFT_JIS_2004
SELECT CONVERT('foo', 'EUC_JIS_2004', 'SHIFT_JIS_2004');
-- SHIFT_JIS_2004 --> EUC_JIS_2004
SELECT CONVERT('foo', 'SHIFT_JIS_2004', 'EUC_JIS_2004');
-- Note: the built-in conversions are exercised in opr_sanity.sql,
-- so there's no need to do that here.
--
--
-- return to the super user
--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment