Skip to content

Commit 66ae2f3

Browse files
committed
Downgrade ERROR to WARNING in the case where a table does not have a primary key or not-null unique key.
We want to be able to keep processing further tables if we encounter this problem on one of many --tables.
1 parent f6ca290 commit 66ae2f3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bin/pg_repack.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,12 @@ repack_one_database(const char *orderby, char *errbuf, size_t errsize)
472472
table.pkid = getoid(res, i, c++);
473473
table.ckid = getoid(res, i, c++);
474474

475-
if (table.pkid == 0)
476-
ereport(ERROR,
477-
(errcode(E_PG_COMMAND),
478-
errmsg("relation \"%s\" must have a primary key or not-null unique keys", table.target_name)));
475+
if (table.pkid == 0) {
476+
ereport(WARNING,
477+
(errcode(E_PG_COMMAND),
478+
errmsg("relation \"%s\" must have a primary key or not-null unique keys", table.target_name)));
479+
continue;
480+
}
479481

480482
table.create_pktype = getstr(res, i, c++);
481483
table.create_log = getstr(res, i, c++);

0 commit comments

Comments
 (0)