From: Marko Kreen Date: Mon, 11 Jan 2010 09:02:40 +0000 (+0200) Subject: Make regtests work across 8.2 .. 8.5 X-Git-Tag: plproxy_2_1_rc1~9 X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpgdulink%28?a=commitdiff_plain;h=6f8d3bf2fe1eda845c383af8b993676d2253190f;p=plproxy.git Make regtests work across 8.2 .. 8.5 - plpgsql is installed by default on 8.5+ - EUC_JP/UTF8 problems with 8.3+ - plproxy.sql output is different in 8.4+ - bytea output is different in 8.5+ --- diff --git a/Makefile b/Makefile index 3a9cc84..4e5453c 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ REGRESS += plproxy_sqlmed PLPROXY_SQL += plproxy_fdw.sql endif -REGRESS_OPTS = --load-language=plpgsql +REGRESS_OPTS = --dbname=regression # load PGXS makefile PGXS = $(shell pg_config --pgxs) diff --git a/expected/plproxy_encoding.out b/expected/plproxy_encoding.out index 43204cb..8556bdc 100644 --- a/expected/plproxy_encoding.out +++ b/expected/plproxy_encoding.out @@ -12,20 +12,15 @@ set client_encoding = 'utf8'; set client_min_messages = 'warning'; drop database if exists test_enc_proxy; drop database if exists test_enc_part; -create database test_enc_proxy with encoding 'euc_jp'; -create database test_enc_part with encoding 'utf-8'; +create database test_enc_proxy with encoding 'euc_jp' template template0; +create database test_enc_part with encoding 'utf-8' template template0; -- initialize proxy db \c test_enc_proxy set client_min_messages = 'warning'; set client_encoding = 'utf-8'; drop language if exists plpgsql; create language plpgsql; -\i plproxy.sql --- handler function -CREATE FUNCTION plproxy_call_handler () -RETURNS language_handler AS '$libdir/plproxy' LANGUAGE C; --- language -CREATE LANGUAGE plproxy HANDLER plproxy_call_handler; +\set ECHO none create schema plproxy; create or replace function plproxy.get_cluster_version(cluster_name text) returns integer as $$ begin return 1; end; $$ language plpgsql; @@ -122,19 +117,14 @@ select * from test_encoding3('クライアント側のデータ'); set client_min_messages = 'warning'; drop database if exists test_enc_proxy; drop database if exists test_enc_part; -create database test_enc_proxy with encoding 'utf-8'; -create database test_enc_part with encoding 'euc_jp'; +create database test_enc_proxy with encoding 'utf-8' template template0; +create database test_enc_part with encoding 'euc_jp' template template0; -- initialize proxy db \c test_enc_proxy set client_min_messages = 'warning'; drop language if exists plpgsql; create language plpgsql; -\i plproxy.sql --- handler function -CREATE FUNCTION plproxy_call_handler () -RETURNS language_handler AS '$libdir/plproxy' LANGUAGE C; --- language -CREATE LANGUAGE plproxy HANDLER plproxy_call_handler; +\set ECHO none set client_encoding = 'utf8'; create schema plproxy; create or replace function plproxy.get_cluster_version(cluster_name text) diff --git a/expected/plproxy_test.out b/expected/plproxy_test.out index 5215a3f..07e7ab1 100644 --- a/expected/plproxy_test.out +++ b/expected/plproxy_test.out @@ -199,6 +199,13 @@ as $$ cluster 'testcluster'; run on hashtext(username); $$ language plproxy; create function test_types(username text, inout vbool boolean, inout xdate timestamp, inout bin bytea) as $$ begin return; end; $$ language plpgsql; \c regression +select 1 from (select set_config(name, 'escape', false) as ignore + from pg_settings where name = 'bytea_output') x +where x.ignore = 'foo'; + ?column? +---------- +(0 rows) + select * from test_types('types', true, '2009-11-04 12:12:02', E'a\\000\\001\\002b'); vbool | xdate | bin -------+--------------------------+---------------- diff --git a/sql/plproxy_encoding.sql b/sql/plproxy_encoding.sql index 4cc3dff..b3b9609 100644 --- a/sql/plproxy_encoding.sql +++ b/sql/plproxy_encoding.sql @@ -17,8 +17,8 @@ set client_encoding = 'utf8'; set client_min_messages = 'warning'; drop database if exists test_enc_proxy; drop database if exists test_enc_part; -create database test_enc_proxy with encoding 'euc_jp'; -create database test_enc_part with encoding 'utf-8'; +create database test_enc_proxy with encoding 'euc_jp' template template0; +create database test_enc_part with encoding 'utf-8' template template0; -- initialize proxy db \c test_enc_proxy @@ -26,7 +26,9 @@ set client_min_messages = 'warning'; set client_encoding = 'utf-8'; drop language if exists plpgsql; create language plpgsql; +\set ECHO none \i plproxy.sql +\set ECHO all create schema plproxy; create or replace function plproxy.get_cluster_version(cluster_name text) returns integer as $$ begin return 1; end; $$ language plpgsql; @@ -87,15 +89,17 @@ select * from test_encoding3('クライアント側のデータ'); set client_min_messages = 'warning'; drop database if exists test_enc_proxy; drop database if exists test_enc_part; -create database test_enc_proxy with encoding 'utf-8'; -create database test_enc_part with encoding 'euc_jp'; +create database test_enc_proxy with encoding 'utf-8' template template0; +create database test_enc_part with encoding 'euc_jp' template template0; -- initialize proxy db \c test_enc_proxy set client_min_messages = 'warning'; drop language if exists plpgsql; create language plpgsql; +\set ECHO none \i plproxy.sql +\set ECHO all set client_encoding = 'utf8'; create schema plproxy; create or replace function plproxy.get_cluster_version(cluster_name text) diff --git a/sql/plproxy_init.sql b/sql/plproxy_init.sql index 65933de..a6bd1f9 100644 --- a/sql/plproxy_init.sql +++ b/sql/plproxy_init.sql @@ -5,6 +5,9 @@ set client_min_messages = 'warning'; \i plproxy.sql +drop language if exists plpgsql; +create language plpgsql; + -- create cluster info functions create schema plproxy; create or replace function plproxy.get_cluster_version(cluster_name text) diff --git a/sql/plproxy_test.sql b/sql/plproxy_test.sql index 4c10908..15eea80 100644 --- a/sql/plproxy_test.sql +++ b/sql/plproxy_test.sql @@ -117,7 +117,11 @@ as $$ cluster 'testcluster'; run on hashtext(username); $$ language plproxy; \c test_part create function test_types(username text, inout vbool boolean, inout xdate timestamp, inout bin bytea) as $$ begin return; end; $$ language plpgsql; + \c regression +select 1 from (select set_config(name, 'escape', false) as ignore + from pg_settings where name = 'bytea_output') x +where x.ignore = 'foo'; select * from test_types('types', true, '2009-11-04 12:12:02', E'a\\000\\001\\002b'); select * from test_types('types', NULL, NULL, NULL);