Make regtests work across 8.2 .. 8.5
authorMarko Kreen <markokr@gmail.com>
Mon, 11 Jan 2010 09:02:40 +0000 (11:02 +0200)
committerMarko Kreen <markokr@gmail.com>
Mon, 11 Jan 2010 09:08:57 +0000 (11:08 +0200)
- 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+

Makefile
expected/plproxy_encoding.out
expected/plproxy_test.out
sql/plproxy_encoding.sql
sql/plproxy_init.sql
sql/plproxy_test.sql

index 3a9cc840e4285a00e1b9a7d3a2a1430437ebefe7..4e5453c693ab1095e0f1961977cf31a30a5bd155 100644 (file)
--- 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)
index 43204cbcf986312ccd0f14c5fe8e1ec8c171f305..8556bdc0f918bd42dcc983cfa45ff6e4f8cc582a 100644 (file)
@@ -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)
index 5215a3f3ff8f93536d6b08687aad4b5cf49c479d..07e7ab1d1322c531a097fab114ef9cd0680abcc6 100644 (file)
@@ -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       
 -------+--------------------------+----------------
index 4cc3dffd7c06c53e353a0e9923784783d9d9d9bb..b3b960950283204e008bc2a07ac6d06838ee832a 100644 (file)
@@ -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)
index 65933de98f3f8822010d1b2a2394c5e2ede18ff7..a6bd1f94959d908918b78a63aea3854e7e4a747b 100644 (file)
@@ -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)
index 4c10908d5589b7fba1edcaab5a00bb50ddc4718a..15eea802e57db682146ce7ec8cb61bb9fffbc664 100644 (file)
@@ -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);