*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 int);
CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2, c3, c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
-----------------------------------------------------------------
CREATE UNIQUE INDEX tbl_idx ON tbl USING btree (c1, c2, c3, c4)
(1 row)
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box);
CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2) INCLUDING(c3,c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------------------------------------------------------------------------
CREATE UNIQUE INDEX tbl_idx ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
(1 row)
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
* as well as key columns deletion. It's explained in documentation.
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------------------------------------------------------------------------------------
CREATE UNIQUE INDEX tbl_c1_c2_c3_c4_key ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
(1 row)
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
ALTER TABLE tbl DROP COLUMN c1;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
INSERT INTO tbl select x, 2*x, 3*x, box('4,4,4,4') from generate_series(1,1000) as x;
CREATE UNIQUE INDEX CONCURRENTLY on tbl (c1, c2) INCLUDING (c3, c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------------------------------------------------------------------------------------
- CREATE UNIQUE INDEX tbl_c1_c2_c3_c4_key ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
CREATE UNIQUE INDEX tbl_c1_c2_c3_c4_idx ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
+ CREATE UNIQUE INDEX tbl_c1_c2_c3_c4_key ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
(2 rows)
DROP TABLE tbl;
* 5. REINDEX
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------------------------------------------------------------------------------------
CREATE UNIQUE INDEX tbl_c1_c2_c3_c4_key ON tbl USING btree (c1, c2) INCLUDING (c3, c4)
(1 row)
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
REINDEX INDEX tbl_c1_c2_c3_c4_key;
ERROR: relation "tbl_c1_c2_c3_c4_key" does not exist
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
ALTER TABLE tbl DROP COLUMN c1;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
indexdef
----------
(0 rows)
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 int);
CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2, c3, c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
DROP TABLE tbl;
/*
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box);
CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2) INCLUDING(c3,c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
DROP TABLE tbl;
/*
* as well as key columns deletion. It's explained in documentation.
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c1;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
DROP TABLE tbl;
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
INSERT INTO tbl select x, 2*x, 3*x, box('4,4,4,4') from generate_series(1,1000) as x;
CREATE UNIQUE INDEX CONCURRENTLY on tbl (c1, c2) INCLUDING (c3, c4);
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
DROP TABLE tbl;
* 5. REINDEX
*/
CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDING(c3,c4));
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c3;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
REINDEX INDEX tbl_c1_c2_c3_c4_key;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
ALTER TABLE tbl DROP COLUMN c1;
-select indexdef from pg_indexes where tablename='tbl';
+select indexdef from pg_indexes where tablename = 'tbl' order by indexname;
DROP TABLE tbl;
/*