Fix psql-dependent name tests

Used the constraint view as needed and changed most \d commands to \di
or \dt list commands (which are identical in 9.5, 9.6, and 10).
pull/1439/head
Jason Petersen 2017-05-31 10:37:09 -06:00
parent 60d15367ca
commit 05ba20f78c
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 76 additions and 139 deletions

View File

@ -20,18 +20,13 @@ SELECT master_create_worker_shards('too_long_12345678901234567890123456789012345
(1 row)
\c - - - :worker_1_port
\d too_long_*
Table "public.too_long_12345678901234567890123456789012345678_e0119164_225000"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
Table "public.too_long_12345678901234567890123456789012345678_e0119164_225001"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
\dt too_long_*
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------------------------------------+-------+----------
public | too_long_12345678901234567890123456789012345678_e0119164_225000 | table | postgres
public | too_long_12345678901234567890123456789012345678_e0119164_225001 | table | postgres
(2 rows)
\c - - - :master_port
-- Verify that the UDF works and rejects bad arguments.
@ -83,8 +78,7 @@ ERROR: cannot create constraint without a name on a distributed table
ALTER TABLE name_lengths ADD CHECK (date_col_12345678901234567890123456789012345678901234567890 > '2014-01-01'::date);
ERROR: cannot create constraint without a name on a distributed table
\c - - - :worker_1_port
\d name_lengths_*
Table "public.name_lengths_225002"
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.name_lengths_225002'::regclass;
Column | Type | Modifiers
--------------------------------------------------------------+------------------+-----------
col1 | integer | not null
@ -92,19 +86,7 @@ ERROR: cannot create constraint without a name on a distributed table
float_col_12345678901234567890123456789012345678901234567890 | double precision |
date_col_12345678901234567890123456789012345678901234567890 | date |
int_col_12345678901234567890123456789012345678901234567890 | integer | default 1
Indexes:
"constraint_a_225002" UNIQUE CONSTRAINT, btree (col1)
Table "public.name_lengths_225003"
Column | Type | Modifiers
--------------------------------------------------------------+------------------+-----------
col1 | integer | not null
col2 | integer | not null
float_col_12345678901234567890123456789012345678901234567890 | double precision |
date_col_12345678901234567890123456789012345678901234567890 | date |
int_col_12345678901234567890123456789012345678901234567890 | integer | default 1
Indexes:
"constraint_a_225003" UNIQUE CONSTRAINT, btree (col1)
(5 rows)
\c - - - :master_port
-- Placeholders for unsupported add constraints with EXPLICIT names that are too long
@ -118,7 +100,12 @@ ALTER TABLE name_lengths ADD CONSTRAINT nl_checky_123456789012345678901234567890
NOTICE: using one-phase commit for distributed DDL commands
HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc'
\c - - - :worker_1_port
\d nl_*
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.name_lengths_225002'::regclass;
Constraint | Definition
-----------------------------------------------------------------+-------------------------------------------------------------------------------------------
nl_checky_1234567890123456789012345678901234567_b16df46d_225002 | CHECK (date_col_12345678901234567890123456789012345678901234567890 >= '01-01-2014'::date)
(1 row)
\c - - - :master_port
-- Placeholders for RENAME operations
ALTER TABLE name_lengths RENAME TO name_len_12345678901234567890123456789012345678901234567890;
@ -203,22 +190,18 @@ CREATE TABLE sneaky_name_lengths (
col2 integer not null,
CONSTRAINT checky_12345678901234567890123456789012345678901234567890 CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
);
\d sneaky_name_lengths*
Table "public.sneaky_name_lengths"
Column | Type | Modifiers
----------------------------------------------------------------+---------+-----------
int_col_123456789012345678901234567890123456789012345678901234 | integer | not null
col2 | integer | not null
Indexes:
"sneaky_name_lengths_int_col_1234567890123456789012345678901_key" UNIQUE CONSTRAINT, btree (int_col_123456789012345678901234567890123456789012345678901234)
Check constraints:
"checky_12345678901234567890123456789012345678901234567890" CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
\di public.sneaky_name_lengths*
List of relations
Schema | Name | Type | Owner | Table
--------+-----------------------------------------------------------------+-------+----------+---------------------
public | sneaky_name_lengths_int_col_1234567890123456789012345678901_key | index | postgres | sneaky_name_lengths
(1 row)
Index "public.sneaky_name_lengths_int_col_1234567890123456789012345678901_key"
Column | Type | Definition
----------------------------------------------------------------+---------+----------------------------------------------------------------
int_col_123456789012345678901234567890123456789012345678901234 | integer | int_col_123456789012345678901234567890123456789012345678901234
unique, btree, for table "public.sneaky_name_lengths"
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.sneaky_name_lengths'::regclass;
Constraint | Definition
-----------------------------------------------------------+------------------------------------------------------------------------------
checky_12345678901234567890123456789012345678901234567890 | CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
(1 row)
SELECT master_create_distributed_table('sneaky_name_lengths', 'int_col_123456789012345678901234567890123456789012345678901234', 'hash');
master_create_distributed_table
@ -233,38 +216,18 @@ SELECT master_create_worker_shards('sneaky_name_lengths', '2', '2');
(1 row)
\c - - - :worker_1_port
\d sneaky_name_lengths*
Table "public.sneaky_name_lengths_225006"
Column | Type | Modifiers
----------------------------------------------------------------+---------+-----------
int_col_123456789012345678901234567890123456789012345678901234 | integer | not null
col2 | integer | not null
Indexes:
"sneaky_name_lengths_int_col_1234567890123456789_6402d2cd_225006" UNIQUE CONSTRAINT, btree (int_col_123456789012345678901234567890123456789012345678901234)
Check constraints:
"checky_12345678901234567890123456789012345678901234567890" CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
\di public.sneaky*225006
List of relations
Schema | Name | Type | Owner | Table
--------+-----------------------------------------------------------------+-------+----------+----------------------------
public | sneaky_name_lengths_int_col_1234567890123456789_6402d2cd_225006 | index | postgres | sneaky_name_lengths_225006
(1 row)
Table "public.sneaky_name_lengths_225007"
Column | Type | Modifiers
----------------------------------------------------------------+---------+-----------
int_col_123456789012345678901234567890123456789012345678901234 | integer | not null
col2 | integer | not null
Indexes:
"sneaky_name_lengths_int_col_1234567890123456789_6402d2cd_225007" UNIQUE CONSTRAINT, btree (int_col_123456789012345678901234567890123456789012345678901234)
Check constraints:
"checky_12345678901234567890123456789012345678901234567890" CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
Index "public.sneaky_name_lengths_int_col_1234567890123456789_6402d2cd_225006"
Column | Type | Definition
----------------------------------------------------------------+---------+----------------------------------------------------------------
int_col_123456789012345678901234567890123456789012345678901234 | integer | int_col_123456789012345678901234567890123456789012345678901234
unique, btree, for table "public.sneaky_name_lengths_225006"
Index "public.sneaky_name_lengths_int_col_1234567890123456789_6402d2cd_225007"
Column | Type | Definition
----------------------------------------------------------------+---------+----------------------------------------------------------------
int_col_123456789012345678901234567890123456789012345678901234 | integer | int_col_123456789012345678901234567890123456789012345678901234
unique, btree, for table "public.sneaky_name_lengths_225007"
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.sneaky_name_lengths_225006'::regclass;
Constraint | Definition
-----------------------------------------------------------+------------------------------------------------------------------------------
checky_12345678901234567890123456789012345678901234567890 | CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
(1 row)
\c - - - :master_port
DROP TABLE sneaky_name_lengths CASCADE;
@ -288,24 +251,12 @@ SELECT master_create_worker_shards('sneaky_name_lengths', '2', '2');
(1 row)
\c - - - :worker_1_port
\d sneaky_name_lengths*
Table "public.sneaky_name_lengths_225008"
Column | Type | Modifiers
------------------------------------------------------------+---------+-----------
col1 | integer | not null
col2 | integer | not null
int_col_12345678901234567890123456789012345678901234567890 | integer | not null
Indexes:
"unique_1234567890123456789012345678901234567890_a5986f27_225008" UNIQUE CONSTRAINT, btree (col1)
Table "public.sneaky_name_lengths_225009"
Column | Type | Modifiers
------------------------------------------------------------+---------+-----------
col1 | integer | not null
col2 | integer | not null
int_col_12345678901234567890123456789012345678901234567890 | integer | not null
Indexes:
"unique_1234567890123456789012345678901234567890_a5986f27_225009" UNIQUE CONSTRAINT, btree (col1)
\di unique*225008
List of relations
Schema | Name | Type | Owner | Table
--------+-----------------------------------------------------------------+-------+----------+----------------------------
public | unique_1234567890123456789012345678901234567890_a5986f27_225008 | index | postgres | sneaky_name_lengths_225008
(1 row)
\c - - - :master_port
DROP TABLE sneaky_name_lengths CASCADE;
@ -327,18 +278,13 @@ SELECT master_create_worker_shards('too_long_12345678901234567890123456789012345
(1 row)
\c - - - :worker_1_port
\d too_long_*
Table "public.too_long_1234567890123456789012345678901_e0119164_2250000000000"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
Table "public.too_long_1234567890123456789012345678901_e0119164_2250000000001"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
\dt *225000000000*
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------------------------------------+-------+----------
public | too_long_1234567890123456789012345678901_e0119164_2250000000000 | table | postgres
public | too_long_1234567890123456789012345678901_e0119164_2250000000001 | table | postgres
(2 rows)
\c - - - :master_port
DROP TABLE too_long_12345678901234567890123456789012345678901234567890 CASCADE;
@ -359,34 +305,21 @@ SELECT master_create_worker_shards(U&'elephant_!0441!043B!043E!043D!0441!043B!04
(1 row)
\c - - - :worker_1_port
\d elephant_*
Index "public.elephant_слонслонслонсло_14d34928_2250000000002"
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
primary key, btree, for table "public.elephant_слонслонслонсло_c8b737c2_2250000000002"
\dt public.elephant_*
List of relations
Schema | Name | Type | Owner
--------+-------------------------------------------------+-------+----------
public | elephant_слонслонслонсло_c8b737c2_2250000000002 | table | postgres
public | elephant_слонслонслонсло_c8b737c2_2250000000003 | table | postgres
(2 rows)
Index "public.elephant_слонслонслонсло_14d34928_2250000000003"
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
primary key, btree, for table "public.elephant_слонслонслонсло_c8b737c2_2250000000003"
Table "public.elephant_слонслонслонсло_c8b737c2_2250000000002"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
Indexes:
"elephant_слонслонслонсло_14d34928_2250000000002" PRIMARY KEY, btree (col1)
Table "public.elephant_слонслонслонсло_c8b737c2_2250000000003"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer | not null
col2 | integer | not null
Indexes:
"elephant_слонслонслонсло_14d34928_2250000000003" PRIMARY KEY, btree (col1)
\di public.elephant_*
List of relations
Schema | Name | Type | Owner | Table
--------+-------------------------------------------------+-------+----------+-------------------------------------------------
public | elephant_слонслонслонсло_14d34928_2250000000002 | index | postgres | elephant_слонслонслонсло_c8b737c2_2250000000002
public | elephant_слонслонслонсло_14d34928_2250000000003 | index | postgres | elephant_слонслонслонсло_c8b737c2_2250000000003
(2 rows)
\c - - - :master_port
-- Clean up.

View File

@ -14,7 +14,7 @@ SELECT master_create_distributed_table('too_long_1234567890123456789012345678901
SELECT master_create_worker_shards('too_long_12345678901234567890123456789012345678901234567890', '2', '2');
\c - - - :worker_1_port
\d too_long_*
\dt too_long_*
\c - - - :master_port
-- Verify that the UDF works and rejects bad arguments.
@ -50,7 +50,7 @@ ALTER TABLE name_lengths ADD EXCLUDE (int_col_1234567890123456789012345678901234
ALTER TABLE name_lengths ADD CHECK (date_col_12345678901234567890123456789012345678901234567890 > '2014-01-01'::date);
\c - - - :worker_1_port
\d name_lengths_*
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.name_lengths_225002'::regclass;
\c - - - :master_port
-- Placeholders for unsupported add constraints with EXPLICIT names that are too long
@ -59,7 +59,7 @@ ALTER TABLE name_lengths ADD CONSTRAINT nl_exclude_12345678901234567890123456789
ALTER TABLE name_lengths ADD CONSTRAINT nl_checky_12345678901234567890123456789012345678901234567890 CHECK (date_col_12345678901234567890123456789012345678901234567890 >= '2014-01-01'::date);
\c - - - :worker_1_port
\d nl_*
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.name_lengths_225002'::regclass;
\c - - - :master_port
-- Placeholders for RENAME operations
@ -99,13 +99,16 @@ CREATE TABLE sneaky_name_lengths (
col2 integer not null,
CONSTRAINT checky_12345678901234567890123456789012345678901234567890 CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
);
\d sneaky_name_lengths*
\di public.sneaky_name_lengths*
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.sneaky_name_lengths'::regclass;
SELECT master_create_distributed_table('sneaky_name_lengths', 'int_col_123456789012345678901234567890123456789012345678901234', 'hash');
SELECT master_create_worker_shards('sneaky_name_lengths', '2', '2');
\c - - - :worker_1_port
\d sneaky_name_lengths*
\di public.sneaky*225006
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.sneaky_name_lengths_225006'::regclass;
\c - - - :master_port
DROP TABLE sneaky_name_lengths CASCADE;
@ -121,7 +124,7 @@ SELECT master_create_distributed_table('sneaky_name_lengths', 'col1', 'hash');
SELECT master_create_worker_shards('sneaky_name_lengths', '2', '2');
\c - - - :worker_1_port
\d sneaky_name_lengths*
\di unique*225008
\c - - - :master_port
DROP TABLE sneaky_name_lengths CASCADE;
@ -135,7 +138,7 @@ SELECT master_create_distributed_table('too_long_1234567890123456789012345678901
SELECT master_create_worker_shards('too_long_12345678901234567890123456789012345678901234567890', '2', '2');
\c - - - :worker_1_port
\d too_long_*
\dt *225000000000*
\c - - - :master_port
DROP TABLE too_long_12345678901234567890123456789012345678901234567890 CASCADE;
@ -148,7 +151,8 @@ SELECT master_create_distributed_table(U&'elephant_!0441!043B!043E!043D!0441!043
SELECT master_create_worker_shards(U&'elephant_!0441!043B!043E!043D!0441!043B!043E!043D!0441!043B!043E!043D!0441!043B!043E!043D!0441!043B!043E!043D!0441!043B!043E!043D' UESCAPE '!', '2', '2');
\c - - - :worker_1_port
\d elephant_*
\dt public.elephant_*
\di public.elephant_*
\c - - - :master_port
-- Clean up.