Some error handling cleanup for index building.
Don't bother doing a 'goto cleanup;' after an ereport(ERROR, ...).
This commit is contained in:
parent
61bf8acaf0
commit
8337204ae6
@ -1626,7 +1626,6 @@ repack_one_index(Oid table, const char *table_name, Oid index, const char *schem
|
|||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(EINVAL),
|
ereport(ERROR, (errcode(EINVAL),
|
||||||
errmsg("unable to generate SQL to CREATE new index")));
|
errmsg("unable to generate SQL to CREATE new index")));
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
create_idx = getstr(res, 0, 0);
|
create_idx = getstr(res, 0, 0);
|
||||||
CLEARPGRES(res);
|
CLEARPGRES(res);
|
||||||
@ -1648,7 +1647,6 @@ repack_one_index(Oid table, const char *table_name, Oid index, const char *schem
|
|||||||
" was interrupted and failed to clean up"
|
" was interrupted and failed to clean up"
|
||||||
" the temporary objects. Please use \"DROP INDEX %s\""
|
" the temporary objects. Please use \"DROP INDEX %s\""
|
||||||
" to remove this index.", temp_index.data)));
|
" to remove this index.", temp_index.data)));
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
CLEARPGRES(res);
|
CLEARPGRES(res);
|
||||||
|
|
||||||
@ -1669,6 +1667,8 @@ repack_one_index(Oid table, const char *table_name, Oid index, const char *schem
|
|||||||
pgut_command(connection, "SELECT repack.repack_index_swap($1)", 1, params);
|
pgut_command(connection, "SELECT repack.repack_index_swap($1)", 1, params);
|
||||||
pgut_command(connection, "COMMIT", 0, NULL);
|
pgut_command(connection, "COMMIT", 0, NULL);
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
|
||||||
drop_idx:
|
drop_idx:
|
||||||
initStringInfo(&sql);
|
initStringInfo(&sql);
|
||||||
#if PG_VERSION_NUM < 90200
|
#if PG_VERSION_NUM < 90200
|
||||||
@ -1678,9 +1678,7 @@ drop_idx:
|
|||||||
#endif
|
#endif
|
||||||
appendStringInfo(&sql, "%s", temp_index.data);
|
appendStringInfo(&sql, "%s", temp_index.data);
|
||||||
command(sql.data, 0, NULL);
|
command(sql.data, 0, NULL);
|
||||||
ret = true;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
CLEARPGRES(res);
|
CLEARPGRES(res);
|
||||||
termStringInfo(&sql);
|
termStringInfo(&sql);
|
||||||
return ret;
|
return ret;
|
||||||
@ -1735,7 +1733,6 @@ repack_all_indexes(char *errbuf, size_t errsize)
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(EINVAL),
|
(errcode(EINVAL),
|
||||||
errmsg("index \"%s\" does not exist.\n", r_index)));
|
errmsg("index \"%s\" does not exist.\n", r_index)));
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1769,7 +1766,8 @@ repack_all_indexes(char *errbuf, size_t errsize)
|
|||||||
num = PQntuples(res);
|
num = PQntuples(res);
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
{
|
{
|
||||||
elog(WARNING, "\"%s\" does not have any indexes", table_list.head->val);
|
elog(WARNING, "\"%s\" does not have any indexes",
|
||||||
|
table_list.head->val);
|
||||||
ret = true;
|
ret = true;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user