Skip to content

Commit 0511137

Browse files
committed
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.
1 parent 0942141 commit 0511137

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

bin/expected/reorg.out

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ CREATE TABLE tbl_badindex (
5050
id integer PRIMARY KEY,
5151
n integer
5252
);
53+
CREATE TABLE tbl_idxopts (
54+
i integer PRIMARY KEY,
55+
t text
56+
);
57+
CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa');
5358
--
5459
-- insert data
5560
--
@@ -80,6 +85,7 @@ INSERT INTO tbl_badindex VALUES(2, 10);
8085
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
8186
ERROR: could not create unique index "idx_badindex_n"
8287
DETAIL: Key (n)=(10) is duplicated.
88+
INSERT INTO tbl_idxopts VALUES (0, 'abc'), (1, 'aaa'), (2, NULL), (3, 'bbb');
8389
--
8490
-- before
8591
--
@@ -176,6 +182,16 @@ Table "public.tbl_with_dropped_toast"
176182
Indexes:
177183
"tbl_with_dropped_toast_pkey" PRIMARY KEY, btree (i, j) CLUSTER
178184

185+
\d tbl_idxopts
186+
Table "public.tbl_idxopts"
187+
Column | Type | Modifiers
188+
--------+---------+-----------
189+
i | integer | not null
190+
t | text |
191+
Indexes:
192+
"tbl_idxopts_pkey" PRIMARY KEY, btree (i)
193+
"idxopts_t" btree (t DESC NULLS LAST) WHERE t <> 'aaa'::text
194+
179195
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
180196
col1 | to_char | ,")
181197
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

bin/sql/reorg.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ CREATE TABLE tbl_badindex (
6060
n integer
6161
);
6262

63+
CREATE TABLE tbl_idxopts (
64+
i integer PRIMARY KEY,
65+
t text
66+
);
67+
CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa');
68+
6369
--
6470
-- insert data
6571
--
@@ -96,6 +102,8 @@ INSERT INTO tbl_badindex VALUES(1, 10);
96102
INSERT INTO tbl_badindex VALUES(2, 10);
97103
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
98104

105+
INSERT INTO tbl_idxopts VALUES (0, 'abc'), (1, 'aaa'), (2, NULL), (3, 'bbb');
106+
99107
--
100108
-- before
101109
--
@@ -122,6 +130,7 @@ SELECT * FROM tbl_with_dropped_toast;
122130
\d tbl_only_pkey
123131
\d tbl_with_dropped_column
124132
\d tbl_with_dropped_toast
133+
\d tbl_idxopts
125134

126135
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
127136
SELECT * FROM tbl_only_ckey ORDER BY 1;

lib/reorg.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,6 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
499499
/*
500500
* FIXME: this is very unreliable implementation but I don't want to
501501
* re-implement customized versions of pg_get_indexdef_string...
502-
*
503-
* TODO: Support ASC/DESC and NULL FIRST/LAST.
504502
*/
505503

506504
initStringInfo(&str);

0 commit comments

Comments
 (0)