Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions bin/pg_repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,12 @@ is_superuser(void)
return false;
}

/*
* Check if the tables are System tables releated to pg_catalog or information_schema
* throw a meaning full error to use VACUUM FULL for those tables.
*/
bool
check_systemtables()

{
PGresult *query_result = NULL;
int num;
Expand Down Expand Up @@ -454,12 +457,11 @@ check_systemtables()
{
if (PQntuples(query_result) >= 1)
{
CLEARPGRES(query_result);
return true;
}
}

CLEARPGRES(query_result);

return false;
}

Expand Down Expand Up @@ -529,12 +531,6 @@ preliminary_checks(char *errbuf, size_t errsize){
goto cleanup;
}

if (check_systemtables()) {
if (errbuf)
snprintf(errbuf, errsize, "For System Tables Use VACUUM FULL.");
goto cleanup;
}

/* Query the extension version. Exit if no match */
res = execute_elevel("select repack.version(), repack.version_sql()",
0, NULL, DEBUG2);
Expand Down Expand Up @@ -622,6 +618,13 @@ is_requested_relation_exists(char *errbuf, size_t errsize){
int num_relations;
SimpleStringListCell *cell;

/*Handling system tables to return meaningful error message*/
if (check_systemtables()) {
if (errbuf)
snprintf(errbuf, errsize,"For System tables use VACUUM FULL.");
return false;
}

num_relations = simple_string_list_size(parent_table_list) +
simple_string_list_size(table_list);

Expand Down