Browse Source
- Commit merged files from Alexander
- Commit merged files from Alexander
added: storage/connect/mysql-test/connect/r/odbc_postgresql.result storage/connect/mysql-test/connect/t/have_odbc_postgresql.inc storage/connect/mysql-test/connect/t/odbc_postgresql.sql storage/connect/mysql-test/connect/t/odbc_postgresql.test modified: storage/connect/odbconn.cpppull/3/head
5 changed files with 630 additions and 6 deletions
-
296storage/connect/mysql-test/connect/r/odbc_postgresql.result
-
15storage/connect/mysql-test/connect/t/have_odbc_postgresql.inc
-
25storage/connect/mysql-test/connect/t/odbc_postgresql.sql
-
198storage/connect/mysql-test/connect/t/odbc_postgresql.test
-
102storage/connect/odbconn.cpp
@ -0,0 +1,296 @@ |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`Name` varchar(256) NOT NULL, |
|||
`Description` varchar(256) NOT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' |
|||
SET NAMES utf8; |
|||
# |
|||
# Checking CATFUNC=Tables |
|||
# |
|||
|
|||
# All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr public t2 TABLE |
|||
mtr public v1 VIEW |
|||
mtr schema1 t1 TABLE |
|||
mtr schema1 t2 TABLE |
|||
mtr schema1 v1 VIEW |
|||
DROP TABLE t1; |
|||
# All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%.%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr public t2 TABLE |
|||
mtr public v1 VIEW |
|||
mtr schema1 t1 TABLE |
|||
mtr schema1 t2 TABLE |
|||
mtr schema1 v1 VIEW |
|||
DROP TABLE t1; |
|||
# All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr public t2 TABLE |
|||
mtr public v1 VIEW |
|||
mtr schema1 t1 TABLE |
|||
mtr schema1 t2 TABLE |
|||
mtr schema1 v1 VIEW |
|||
DROP TABLE t1; |
|||
# All tables in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr public t2 TABLE |
|||
mtr public v1 VIEW |
|||
DROP TABLE t1; |
|||
# All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr schema1 t1 TABLE |
|||
DROP TABLE t1; |
|||
# All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr schema1 t1 TABLE |
|||
DROP TABLE t1; |
|||
# Table "t1" in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.public.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.schema1.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr schema1 t1 TABLE |
|||
DROP TABLE t1; |
|||
# All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='xxx.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualifier Table_Owner Table_Name Table_Type Remark |
|||
mtr public t1 TABLE |
|||
mtr schema1 t1 TABLE |
|||
DROP TABLE t1; |
|||
# |
|||
# Checking CATFUNC=Columns |
|||
# |
|||
|
|||
# All columns in the schemas "public" and "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns; |
|||
SELECT * FROM t1 WHERE Table_Owner IN ('public','schema1') ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr public t1 a 4 int4 10 4 0 10 0 |
|||
mtr public t2 a 4 int4 10 4 0 10 0 |
|||
mtr public v1 a 4 int4 10 4 0 10 1 |
|||
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 |
|||
mtr schema1 t2 a 1 bpchar 10 60 0 0 0 |
|||
mtr schema1 v1 a 1 bpchar 10 60 0 0 1 |
|||
DROP TABLE t1; |
|||
# All columns in the schemas "public" and "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.%'; |
|||
SELECT * FROM t1 WHERE Table_Owner IN ('public','schema1') ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr public t1 a 4 int4 10 4 0 10 0 |
|||
mtr public t2 a 4 int4 10 4 0 10 0 |
|||
mtr public v1 a 4 int4 10 4 0 10 1 |
|||
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 |
|||
mtr schema1 t2 a 1 bpchar 10 60 0 0 0 |
|||
mtr schema1 v1 a 1 bpchar 10 60 0 0 1 |
|||
DROP TABLE t1; |
|||
# All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr public t1 a 4 int4 10 4 0 10 0 |
|||
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.public.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr public t1 a 4 int4 10 4 0 10 0 |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.schema1.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 |
|||
DROP TABLE t1; |
|||
# All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='xxx.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks |
|||
mtr public t1 a 4 int4 10 4 0 10 0 |
|||
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 |
|||
DROP TABLE t1; |
|||
# |
|||
# Checking tables |
|||
# |
|||
|
|||
# Table "t1" in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(10) NOT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' |
|||
SELECT * FROM t1; |
|||
a |
|||
10 |
|||
20 |
|||
30 |
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
Table Create Table |
|||
t2 CREATE TABLE `t2` ( |
|||
`a` int(10) NOT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
SELECT * FROM t2; |
|||
a |
|||
10 |
|||
20 |
|||
30 |
|||
DROP TABLE t2; |
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
a |
|||
10 |
|||
20 |
|||
30 |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='public.t1' TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(10) NOT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='public.t1' |
|||
SELECT * FROM t1; |
|||
a |
|||
10 |
|||
20 |
|||
30 |
|||
DROP TABLE t1; |
|||
# Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.t1' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` char(10) NOT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8' |
|||
SELECT * FROM t1; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
Table Create Table |
|||
t2 CREATE TABLE `t2` ( |
|||
`a` char(10) CHARACTER SET utf8 NOT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
SELECT * FROM t2; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
DROP TABLE t2; |
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
# View "v1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.v1' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` char(10) DEFAULT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8' |
|||
SELECT * FROM t1; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
Table Create Table |
|||
t2 CREATE TABLE `t2` ( |
|||
`a` char(10) CHARACTER SET utf8 DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
SELECT * FROM t2; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
DROP TABLE t2; |
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
a |
|||
aaa |
|||
bbb |
|||
ccc |
|||
яяя |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
# Table "t2" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.t2' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` char(10) NOT NULL |
|||
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8' |
|||
SELECT * FROM t1; |
|||
a |
|||
xxx |
|||
yyy |
|||
zzz |
|||
ÄÖÜ |
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
Table Create Table |
|||
t2 CREATE TABLE `t2` ( |
|||
`a` char(10) CHARACTER SET utf8 NOT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
SELECT * FROM t2; |
|||
a |
|||
xxx |
|||
yyy |
|||
zzz |
|||
ÄÖÜ |
|||
DROP TABLE t2; |
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
a |
|||
xxx |
|||
yyy |
|||
zzz |
|||
ÄÖÜ |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,15 @@ |
|||
--disable_query_log |
|||
--error 0,ER_UNKNOWN_ERROR |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Sources; |
|||
if ($mysql_errno) |
|||
{ |
|||
Skip No ODBC support; |
|||
} |
|||
if (!`SELECT count(*) FROM t1 WHERE Name='ConnectEnginePostgresql'`) |
|||
{ |
|||
DROP TABLE t1; |
|||
Skip Need ODBC data source ConnectEnginePostgresql; |
|||
} |
|||
SHOW CREATE TABLE t1; |
|||
DROP TABLE t1; |
|||
--enable_query_log |
|||
@ -0,0 +1,25 @@ |
|||
-- |
|||
-- The SQL script to create PostgreSQL data for odbc_postgresql.test |
|||
-- |
|||
-- Run this script as a admin user: |
|||
-- sudo -u postgres psql < odbc_postgresql.create.sql |
|||
|
|||
DROP DATABASE IF EXISTS mtr; |
|||
DROP USER IF EXISTS mtr; |
|||
|
|||
CREATE USER mtr WITH PASSWORD 'mtr'; |
|||
CREATE DATABASE mtr OWNER=mtr ENCODING='UTF8'; |
|||
GRANT ALL ON DATABASE mtr TO mtr; |
|||
\c mtr |
|||
SET role mtr; |
|||
CREATE TABLE t1 (a INT NOT NULL); |
|||
INSERT INTO t1 VALUES (10),(20),(30); |
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
CREATE TABLE t2 (a INT NOT NULL); |
|||
INSERT INTO t2 VALUES (40),(50),(60); |
|||
CREATE SCHEMA schema1 AUTHORIZATION mtr; |
|||
CREATE TABLE schema1.t1 (a CHAR(10) NOT NULL); |
|||
INSERT INTO schema1.t1 VALUES ('aaa'),('bbb'),('ccc'),('яяя'); |
|||
CREATE VIEW schema1.v1 AS SELECT * FROM schema1.t1; |
|||
CREATE TABLE schema1.t2 (a CHAR(10) NOT NULL); |
|||
INSERT INTO schema1.t2 VALUES ('xxx'),('yyy'),('zzz'),('ÄÖÜ'); |
|||
@ -0,0 +1,198 @@ |
|||
--source have_odbc_postgresql.inc |
|||
--source include/not_embedded.inc |
|||
|
|||
# |
|||
# To configure your system to be able to run this test, |
|||
# follow through the following steps: |
|||
# |
|||
# 1. Install and configure PostgreSQL database to stat on the system startup |
|||
# |
|||
# 2. Create user, database, schema and tables to be used by mtr: |
|||
# sudo -u postgres < odbc_postgresql.sql |
|||
# |
|||
# 3. Install PostgreSQL ODBC Driver. |
|||
# - On CentOS, Fedora: |
|||
# sudo yum install postgresql-odbc |
|||
# - On Ubuntu, Debian: |
|||
# sudo apt-get install odbc-postgresql |
|||
# |
|||
# 4. Create a data source with the name "ConnectEnginePostgresql" |
|||
# - On Windows: use odbcadm.exe |
|||
# - On Linux: put these lines into /etc/odbc.ini |
|||
# |
|||
#[ConnectEnginePostgresql] |
|||
#Description=PostgreSQL DSN for ConnectSE |
|||
#Driver=PostgreSQL |
|||
#Database=mtr |
|||
#Servername=localhost |
|||
#Port=5432 |
|||
# |
|||
|
|||
SET NAMES utf8; |
|||
|
|||
--echo # |
|||
--echo # Checking CATFUNC=Tables |
|||
--echo # |
|||
--echo |
|||
--echo # All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%.%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.public.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='%.schema1.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Tables TABNAME='xxx.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Checking CATFUNC=Columns |
|||
--echo # |
|||
--echo |
|||
|
|||
# |
|||
# For some reasons SQLColumn (unlike SQLTables) include columns of system |
|||
# tables from the schemas like "information_schema", "pg_catalog", "pg_toast". |
|||
# So we add the "Table_Owner IN ('public','schema1')" clause into some queries. |
|||
# |
|||
|
|||
--echo # All columns in the schemas "public" and "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns; |
|||
SELECT * FROM t1 WHERE Table_Owner IN ('public','schema1') ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All columns in the schemas "public" and "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.%'; |
|||
SELECT * FROM t1 WHERE Table_Owner IN ('public','schema1') ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables "t1" in all schemas |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.public.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.schema1.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='xxx.%.t1'; |
|||
SELECT * FROM t1 ORDER BY Table_Owner, Table_Name; |
|||
DROP TABLE t1; |
|||
|
|||
|
|||
--echo # |
|||
--echo # Checking tables |
|||
--echo # |
|||
--echo |
|||
|
|||
--echo # Table "t1" in the default schema ("public") |
|||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
|
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
SELECT * FROM t2; |
|||
DROP TABLE t2; |
|||
|
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "public" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='public.t1' TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.t1' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
|
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
SELECT * FROM t2; |
|||
DROP TABLE t2; |
|||
|
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # View "v1" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.v1' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
|
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
SELECT * FROM t2; |
|||
DROP TABLE t2; |
|||
|
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Table "t2" in the schema "schema1" |
|||
CREATE TABLE t1 ENGINE=CONNECT TABNAME='schema1.t2' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; |
|||
SHOW CREATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
|
|||
CREATE TABLE t2 AS SELECT * FROM t1; |
|||
SHOW CREATE TABLE t2; |
|||
SELECT * FROM t2; |
|||
DROP TABLE t2; |
|||
|
|||
CREATE VIEW v1 AS SELECT * FROM t1; |
|||
SELECT * FROM v1; |
|||
DROP VIEW v1; |
|||
DROP TABLE t1; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue