Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Nov 21, 2023
1 parent 90408a2 commit 084394a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/diskquota_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ static float4 get_per_segment_ratio(Oid spcoid);
static bool to_delete_quota(QuotaType type, int64 quota_limit_mb, float4 segratio);
static void check_role(Oid roleoid, char *rolname, int64 quota_limit_mb);

List *get_rel_oid_list(bool is_init);

/* ---- Help Functions to set quota limit. ---- */
/*
* Initialize table diskquota.table_size.
Expand Down Expand Up @@ -1306,11 +1304,11 @@ get_rel_oid_list(bool is_init)
int ret;

#define SELECT_FROM_PG_CATALOG_PG_CLASS \
"select oid from pg_catalog.pg_class where oid >= $1 and (relkind='r' or relkind='m')"
#define SELECT_FROM_DISKQUOTA_TABLE_SIZE "select tableid from diskquota.table_size where segid = -1"
"select oid from pg_catalog.pg_class where oid >= $1 and relkind in ('r', 'm')"

ret = SPI_execute_with_args(is_init ? SELECT_FROM_PG_CATALOG_PG_CLASS
" union distinct " SELECT_FROM_DISKQUOTA_TABLE_SIZE
" union distinct"
" select tableid from diskquota.table_size where segid = -1"
: SELECT_FROM_PG_CATALOG_PG_CLASS,
1,
(Oid[]){
Expand All @@ -1320,6 +1318,9 @@ get_rel_oid_list(bool is_init)
ObjectIdGetDatum(FirstNormalObjectId),
},
NULL, false, 0);

#undef SELECT_FROM_PG_CATALOG_PG_CLASS

if (ret != SPI_OK_SELECT) elog(ERROR, "cannot fetch in pg_class. error code %d", ret);

TupleDesc tupdesc = SPI_tuptable->tupdesc;
Expand Down

0 comments on commit 084394a

Please sign in to comment.