1
1
#! /bin/bash
2
2
3
- # Script for the plan passing between separate instances
3
+ # This script to pass some plans between separate instances.
4
4
U=` whoami`
5
+ export LC_ALL=C
6
+ export LANGUAGE=" en_US:en"
5
7
6
8
# Paths
7
9
PGINSTALL=` pwd` /tmp_install/
@@ -25,8 +27,8 @@ make -C contrib install > /dev/null
25
27
26
28
mkdir PGDATA_Master
27
29
mkdir PGDATA_Slave
28
- initdb -D PGDATA_Master
29
- initdb -D PGDATA_Slave
30
+ initdb -D PGDATA_Master -E UTF8 --locale=C
31
+ initdb -D PGDATA_Slave -E UTF8 --locale=C
30
32
echo " shared_preload_libraries = 'postgres_fdw, pg_execplan'" >> PGDATA_Master/postgresql.conf
31
33
echo " shared_preload_libraries = 'postgres_fdw, pg_execplan'" >> PGDATA_Slave/postgresql.conf
32
34
@@ -47,8 +49,39 @@ psql -p 5433 -c "DROP TABLE t0;"
47
49
# create database objects for check of oid switching
48
50
psql -p 5432 -f contrib/pg_execplan/tests/create_objects.sql
49
51
psql -p 5433 -f contrib/pg_execplan/tests/create_objects.sql
52
+ psql -p 5433 -c " SELECT current_schemas(true);"
50
53
51
54
# TEST ON RELOID and TYPEOID objects.
52
- psql -p 5432 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT * FROM t1;');"
55
+ psql -p 5432 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT * FROM tests.t1;');"
56
+ psql -p 5433 -c " SELECT pg_exec_query_plan('../test.txt');"
57
+
58
+ psql -p 5432 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT tests.select1(42);');"
59
+ psql -p 5433 -c " SELECT pg_exec_query_plan('../test.txt');"
60
+ psql -p 5432 -c " SELECT pg_exec_query_plan('../test.txt');"
61
+
62
+ psql -p 5432 -c " SELECT * FROM tests.t2;"
63
+ psql -p 5433 -c " SELECT * FROM tests.t2;"
64
+
65
+ # COLLOID ----------------------------------------------------------------------
66
+ # Check on different oids
67
+ psql -p 5432 -c " SELECT oid, * FROM pg_collation WHERE collname LIKE 'test%';"
68
+ psql -p 5433 -c " SELECT oid, * FROM pg_collation WHERE collname LIKE 'test%';"
69
+
70
+ psql -p 5432 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT max(id) FROM tests.ttest1 WHERE a < b COLLATE tests.test1');"
71
+ psql -p 5433 -c " SELECT pg_exec_query_plan('../test.txt');"
72
+
73
+ # OPEROID ----------------------------------------------------------------------
74
+ # Check on different oids
75
+ psql -p 5432 -c " SELECT oid, oprname, oprnamespace FROM pg_operator WHERE oprname LIKE '###';"
76
+ psql -p 5433 -c " SELECT oid, oprname, oprnamespace FROM pg_operator WHERE oprname LIKE '###';"
77
+
78
+ # Test
79
+ psql -p 5432 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT id ### 1 FROM tests.ttest1;');"
80
+ psql -p 5433 -c " SELECT pg_exec_query_plan('../test.txt');"
81
+
82
+ psql -p 5433 -c " SELECT pg_store_query_plan('../test.txt', 'SELECT collname, nspname
83
+ FROM pg_collation JOIN pg_namespace ON (collnamespace = pg_namespace.oid)
84
+ WHERE collname LIKE ''test%''
85
+ ORDER BY 1;');"
53
86
psql -p 5433 -c " SELECT pg_exec_query_plan('../test.txt');"
54
87
0 commit comments