MCPcopy Create free account
hub / github.com/apache/cloudberry / AlterQueue

Function AlterQueue

src/backend/commands/queue.c:1001–1415  ·  view source on GitHub ↗

* ALTER RESOURCE QUEUE */

Source from the content-addressed store, hash-verified

999 * ALTER RESOURCE QUEUE
1000 */
1001void
1002AlterQueue(AlterQueueStmt *stmt)
1003{
1004 Relation pg_resqueue_rel;
1005 TupleDesc pg_resqueue_dsc;
1006 ScanKeyData scankey;
1007 SysScanDesc sscan;
1008 HeapTuple tuple, new_tuple;
1009 Oid queueid;
1010 Cost thresholds[NUM_RES_LIMIT_TYPES];
1011 Datum new_record[Natts_pg_resqueue];
1012 bool new_record_nulls[Natts_pg_resqueue];
1013 bool new_record_repl[Natts_pg_resqueue];
1014 ListCell *option;
1015 ListCell *pWithList = NULL;
1016
1017 /* thresholds for active and cost limiters. */
1018 Cost activelimit = INVALID_RES_LIMIT_THRESHOLD;
1019 Cost costlimit = INVALID_RES_LIMIT_THRESHOLD;
1020
1021 /* overcommit indicator */
1022 bool overcommit = false;
1023
1024 /* cost ignore limit for queries */
1025 float4 ignorelimit = 0;
1026
1027 DefElem *dactivelimit = NULL;
1028 DefElem *dcostlimit = NULL;
1029 DefElem *dovercommit = NULL;
1030 DefElem *dignorelimit = NULL;
1031 ResAlterQueueResult queueok;
1032 bool bWith = false;
1033 bool bWithOut = false;
1034 int numopts = 0;
1035 char *alter_subtype = ""; /* metadata tracking: kind of
1036 redundant to say "role" */
1037
1038 /* Permission check - only superuser can alter queues. */
1039 if (!superuser())
1040 ereport(ERROR,
1041 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
1042 errmsg("must be superuser to alter resource queues")));
1043
1044 /* Extract options from the statement node tree */
1045 foreach(option, stmt->options)
1046 {
1047 DefElem *defel = (DefElem *) lfirst(option);
1048
1049 if (strcmp(defel->defname, "active_statements") == 0)
1050 {
1051 if (dactivelimit)
1052 ereport(ERROR,
1053 (errcode(ERRCODE_SYNTAX_ERROR),
1054 errmsg("conflicting or redundant options")));
1055 if (!bWithOut)
1056 dactivelimit = defel;
1057 else
1058 dactivelimit =

Callers 1

standard_ProcessUtilityFunction · 0.85

Calls 15

superuserFunction · 0.85
makeDefElemFunction · 0.85
makeFloatFunction · 0.85
makeIntegerFunction · 0.85
asc_toupperFunction · 0.85
defGetInt64Function · 0.85
defGetNumericFunction · 0.85
defGetBooleanFunction · 0.85
lnextFunction · 0.85
ScanKeyInitFunction · 0.85
CStringGetDatumFunction · 0.85
systable_beginscanFunction · 0.85

Tested by

no test coverage detected