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.
This commit is contained in:
Josh Kupershmidt 2012-10-21 16:54:33 -07:00
parent 0942141245
commit 05111376c8
3 changed files with 25 additions and 2 deletions

View File

@ -50,6 +50,11 @@ CREATE TABLE tbl_badindex (
id integer PRIMARY KEY, id integer PRIMARY KEY,
n integer 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 -- insert data
-- --
@ -80,6 +85,7 @@ INSERT INTO tbl_badindex VALUES(2, 10);
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n); CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
ERROR: could not create unique index "idx_badindex_n" ERROR: could not create unique index "idx_badindex_n"
DETAIL: Key (n)=(10) is duplicated. DETAIL: Key (n)=(10) is duplicated.
INSERT INTO tbl_idxopts VALUES (0, 'abc'), (1, 'aaa'), (2, NULL), (3, 'bbb');
-- --
-- before -- before
-- --
@ -176,6 +182,16 @@ Table "public.tbl_with_dropped_toast"
Indexes: Indexes:
"tbl_with_dropped_toast_pkey" PRIMARY KEY, btree (i, j) CLUSTER "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; SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
col1 | to_char | ,") col1 | to_char | ,")
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -60,6 +60,12 @@ CREATE TABLE tbl_badindex (
n integer 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 -- insert data
-- --
@ -96,6 +102,8 @@ INSERT INTO tbl_badindex VALUES(1, 10);
INSERT INTO tbl_badindex VALUES(2, 10); INSERT INTO tbl_badindex VALUES(2, 10);
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n); 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 -- before
-- --
@ -122,6 +130,7 @@ SELECT * FROM tbl_with_dropped_toast;
\d tbl_only_pkey \d tbl_only_pkey
\d tbl_with_dropped_column \d tbl_with_dropped_column
\d tbl_with_dropped_toast \d tbl_with_dropped_toast
\d tbl_idxopts
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster; SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
SELECT * FROM tbl_only_ckey ORDER BY 1; SELECT * FROM tbl_only_ckey ORDER BY 1;

View File

@ -499,8 +499,6 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
/* /*
* FIXME: this is very unreliable implementation but I don't want to * FIXME: this is very unreliable implementation but I don't want to
* re-implement customized versions of pg_get_indexdef_string... * re-implement customized versions of pg_get_indexdef_string...
*
* TODO: Support ASC/DESC and NULL FIRST/LAST.
*/ */
initStringInfo(&str); initStringInfo(&str);