Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Oct 30, 2024
1 parent 85e6997 commit e26a435
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/quotamodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,13 +1122,13 @@ calculate_table_disk_usage(bool is_init, HTAB *local_active_table_stat_map)
static void
delete_from_table_size_map(ArrayBuildState *tableids, ArrayBuildState *segids)
{
Datum tableid = makeArrayResult(tableids, CurrentMemoryContext);
Datum segid = makeArrayResult(segids, CurrentMemoryContext);
Datum tableid = makeArrayResult(tableids, CurrentMemoryContext);
Datum segid = makeArrayResult(segids, CurrentMemoryContext);

int state = SPI_connect_wrapper();
int ret = SPI_execute_with_args(
"delete from diskquota.table_size where (tableid, segid) in (select * from unnest($1, $2))", 2,
(Oid[]){OIDARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, segid}, NULL, false, 0);
int ret = SPI_execute_with_args(
"delete from diskquota.table_size where (tableid, segid) in (select * from unnest($1, $2))", 2,
(Oid[]){OIDARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, segid}, NULL, false, 0);
if (ret != SPI_OK_DELETE)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("[diskquota] delete_from_table_size_map SPI_execute failed: error code %d", ret)));
Expand All @@ -1140,23 +1140,23 @@ delete_from_table_size_map(ArrayBuildState *tableids, ArrayBuildState *segids)
static void
update_table_size_map(ArrayBuildState *tableids, ArrayBuildState *sizes, ArrayBuildState *segids)
{
Datum tableid = makeArrayResult(tableids, CurrentMemoryContext);
Datum size = makeArrayResult(sizes, CurrentMemoryContext);
Datum segid = makeArrayResult(segids, CurrentMemoryContext);
Datum tableid = makeArrayResult(tableids, CurrentMemoryContext);
Datum size = makeArrayResult(sizes, CurrentMemoryContext);
Datum segid = makeArrayResult(segids, CurrentMemoryContext);

int state = SPI_connect_wrapper();
int ret = SPI_execute_with_args(
"delete from diskquota.table_size where (tableid, segid) in (select * from unnest($1, $2))", 2,
(Oid[]){OIDARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, segid}, NULL, false, 0);
int ret = SPI_execute_with_args(
"delete from diskquota.table_size where (tableid, segid) in (select * from unnest($1, $2))", 2,
(Oid[]){OIDARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, segid}, NULL, false, 0);
if (ret != SPI_OK_DELETE)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("[diskquota] delete_from_table_size_map SPI_execute failed: error code %d", ret)));
SPI_finish_wrapper(state);

state = SPI_connect_wrapper();
ret = SPI_execute_with_args("insert into diskquota.table_size select * from unnest($1, $2, $3)", 3,
(Oid[]){OIDARRAYOID, INT8ARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, size, segid}, NULL,
false, 0);
ret = SPI_execute_with_args("insert into diskquota.table_size select * from unnest($1, $2, $3)", 3,
(Oid[]){OIDARRAYOID, INT8ARRAYOID, INT2ARRAYOID}, (Datum[]){tableid, size, segid}, NULL,
false, 0);
if (ret != SPI_OK_INSERT)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("[diskquota] insert_into_table_size_map SPI_execute failed: error code %d", ret)));
Expand Down

0 comments on commit e26a435

Please sign in to comment.