parent
ef2c7da4a5
commit
44bf1543be
@ -299,6 +299,8 @@ CREATE TABLE tbl_nn (col1 int NOT NULL, col2 int NOT NULL);
|
||||
CREATE TABLE tbl_uk (col1 int NOT NULL, col2 int , UNIQUE(col1, col2));
|
||||
CREATE TABLE tbl_nn_uk (col1 int NOT NULL, col2 int NOT NULL, UNIQUE(col1, col2));
|
||||
CREATE TABLE tbl_pk_uk (col1 int NOT NULL, col2 int NOT NULL, PRIMARY KEY(col1, col2), UNIQUE(col2, col1));
|
||||
CREATE TABLE tbl_nn_puk (col1 int NOT NULL, col2 int NOT NULL);
|
||||
CREATE UNIQUE INDEX tbl_nn_puk_pcol1_idx ON tbl_nn_puk(col1) WHERE col1 < 10;
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn
|
||||
ERROR: relation "tbl_nn" must have a primary key or not-null unique keys
|
||||
-- => ERROR
|
||||
@ -309,3 +311,6 @@ ERROR: relation "tbl_uk" must have a primary key or not-null unique keys
|
||||
-- => OK
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_pk_uk
|
||||
-- => OK
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn_puk
|
||||
ERROR: relation "tbl_nn_puk" must have a primary key or not-null unique keys
|
||||
-- => ERROR
|
||||
|
@ -175,6 +175,8 @@ CREATE TABLE tbl_nn (col1 int NOT NULL, col2 int NOT NULL);
|
||||
CREATE TABLE tbl_uk (col1 int NOT NULL, col2 int , UNIQUE(col1, col2));
|
||||
CREATE TABLE tbl_nn_uk (col1 int NOT NULL, col2 int NOT NULL, UNIQUE(col1, col2));
|
||||
CREATE TABLE tbl_pk_uk (col1 int NOT NULL, col2 int NOT NULL, PRIMARY KEY(col1, col2), UNIQUE(col2, col1));
|
||||
CREATE TABLE tbl_nn_puk (col1 int NOT NULL, col2 int NOT NULL);
|
||||
CREATE UNIQUE INDEX tbl_nn_puk_pcol1_idx ON tbl_nn_puk(col1) WHERE col1 < 10;
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn
|
||||
-- => ERROR
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_uk
|
||||
@ -183,3 +185,5 @@ CREATE TABLE tbl_pk_uk (col1 int NOT NULL, col2 int NOT NULL, PRIMARY KEY(col1,
|
||||
-- => OK
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_pk_uk
|
||||
-- => OK
|
||||
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn_puk
|
||||
-- => ERROR
|
||||
|
@ -154,6 +154,7 @@ CREATE VIEW repack.primary_keys AS
|
||||
FROM (SELECT indrelid, indexrelid FROM pg_index
|
||||
WHERE indisunique
|
||||
AND indisvalid
|
||||
AND indpred IS NULL
|
||||
AND 0 <> ALL(indkey)
|
||||
AND NOT EXISTS(
|
||||
SELECT 1 FROM pg_attribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user