From 05111376c89bf35e629cac56038f7c22cb7036c1 Mon Sep 17 00:00:00 2001 From: Josh Kupershmidt Date: Sun, 21 Oct 2012 16:54:33 -0700 Subject: [PATCH] Remove TODO comment about ASC/DESC and NULLS FIRST/LAST index options. As far as I can tell, the code already supports these index options, so put in a small installcheck test exercising these index options and call it good. --- bin/expected/reorg.out | 16 ++++++++++++++++ bin/sql/reorg.sql | 9 +++++++++ lib/reorg.c | 2 -- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bin/expected/reorg.out b/bin/expected/reorg.out index 86d7a0e..3c32bcf 100755 --- a/bin/expected/reorg.out +++ b/bin/expected/reorg.out @@ -50,6 +50,11 @@ CREATE TABLE tbl_badindex ( id integer PRIMARY KEY, n integer ); +CREATE TABLE tbl_idxopts ( + i integer PRIMARY KEY, + t text +); +CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa'); -- -- insert data -- @@ -80,6 +85,7 @@ INSERT INTO tbl_badindex VALUES(2, 10); CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n); ERROR: could not create unique index "idx_badindex_n" DETAIL: Key (n)=(10) is duplicated. +INSERT INTO tbl_idxopts VALUES (0, 'abc'), (1, 'aaa'), (2, NULL), (3, 'bbb'); -- -- before -- @@ -176,6 +182,16 @@ Table "public.tbl_with_dropped_toast" Indexes: "tbl_with_dropped_toast_pkey" PRIMARY KEY, btree (i, j) CLUSTER +\d tbl_idxopts + Table "public.tbl_idxopts" + Column | Type | Modifiers +--------+---------+----------- + i | integer | not null + t | text | +Indexes: + "tbl_idxopts_pkey" PRIMARY KEY, btree (i) + "idxopts_t" btree (t DESC NULLS LAST) WHERE t <> 'aaa'::text + SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster; col1 | to_char | ,") ------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/bin/sql/reorg.sql b/bin/sql/reorg.sql index 863d2ce..d301475 100755 --- a/bin/sql/reorg.sql +++ b/bin/sql/reorg.sql @@ -60,6 +60,12 @@ CREATE TABLE tbl_badindex ( n integer ); +CREATE TABLE tbl_idxopts ( + i integer PRIMARY KEY, + t text +); +CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa'); + -- -- insert data -- @@ -96,6 +102,8 @@ INSERT INTO tbl_badindex VALUES(1, 10); INSERT INTO tbl_badindex VALUES(2, 10); CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n); +INSERT INTO tbl_idxopts VALUES (0, 'abc'), (1, 'aaa'), (2, NULL), (3, 'bbb'); + -- -- before -- @@ -122,6 +130,7 @@ SELECT * FROM tbl_with_dropped_toast; \d tbl_only_pkey \d tbl_with_dropped_column \d tbl_with_dropped_toast +\d tbl_idxopts SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster; SELECT * FROM tbl_only_ckey ORDER BY 1; diff --git a/lib/reorg.c b/lib/reorg.c index 1dacce1..07c401e 100755 --- a/lib/reorg.c +++ b/lib/reorg.c @@ -499,8 +499,6 @@ reorg_get_index_keys(PG_FUNCTION_ARGS) /* * FIXME: this is very unreliable implementation but I don't want to * re-implement customized versions of pg_get_indexdef_string... - * - * TODO: Support ASC/DESC and NULL FIRST/LAST. */ initStringInfo(&str);