Skip to content

Commit f886e0d

Browse files
committed
Fixed --order-by broken by namespaces refactoring
Also added a regression test for it. Bug and patch from Beena Emerson, thany you.
1 parent 1096895 commit f886e0d

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

bin/expected/tablespace.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ ORDER BY relname;
7878
ERROR: cannot specify --moveidx (-S) without --tablespace (-s)
7979
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 -S
8080
ERROR: cannot specify --moveidx (-S) without --tablespace (-s)
81+
-- not broken with order
82+
\! pg_repack --dbname=contrib_regression -o id --table=testts1 --tablespace pg_default --moveidx
83+
INFO: repacking table "testts1"

bin/pg_repack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ repack_one_database(const char *orderby, char *errbuf, size_t errsize)
617617
/* User specified ORDER BY */
618618
appendStringInfoString(&sql, " ORDER BY ");
619619
appendStringInfoString(&sql, orderby);
620+
table.create_table = sql.data;
620621
}
621622

622623
repack_one_table(&table, orderby);

bin/sql/tablespace.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ ORDER BY relname;
5353
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 --moveidx
5454
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 -S
5555

56+
-- not broken with order
57+
\! pg_repack --dbname=contrib_regression -o id --table=testts1 --tablespace pg_default --moveidx

0 commit comments

Comments
 (0)