Don't choose a partial index as primary key

Fixes reorg/pg_reorg#22
This commit is contained in:
Daniele Varrazzo
2012-11-15 00:16:38 +00:00
parent ef2c7da4a5
commit 44bf1543be
3 changed files with 10 additions and 0 deletions

View File

@ -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