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

Function CreateQueue

src/backend/commands/queue.c:704–995  ·  view source on GitHub ↗

* CREATE RESOURCE QUEUE */

Source from the content-addressed store, hash-verified

702 * CREATE RESOURCE QUEUE
703 */
704void
705CreateQueue(CreateQueueStmt *stmt)
706{
707 Relation pg_resqueue_rel;
708 TupleDesc pg_resqueue_dsc;
709 ScanKeyData scankey;
710 SysScanDesc sscan;
711 HeapTuple tuple;
712 Oid queueid;
713 Cost thresholds[NUM_RES_LIMIT_TYPES];
714 Datum new_record[Natts_pg_resqueue];
715 bool new_record_nulls[Natts_pg_resqueue];
716 ListCell *option;
717 ListCell *pWithList = NULL;
718
719 /* thresholds for active and cost limiters. */
720 Cost activelimit = INVALID_RES_LIMIT_THRESHOLD;
721 Cost costlimit = INVALID_RES_LIMIT_THRESHOLD;
722
723 /* overcommit indicator */
724 bool overcommit = false;
725
726 /* cost ignore limit for queries */
727 float4 ignorelimit = 0;
728
729 DefElem *dactivelimit = NULL;
730 DefElem *dcostlimit = NULL;
731 DefElem *dovercommit = NULL;
732 DefElem *dignorelimit = NULL;
733 bool queueok = false;
734 bool bWith = false;
735
736 /* Permission check - only superuser can create queues. */
737 if (!superuser())
738 ereport(ERROR,
739 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
740 errmsg("must be superuser to create resource queues")));
741
742 /* Extract options from the statement node tree */
743 foreach(option, stmt->options)
744 {
745 DefElem *defel = (DefElem *) lfirst(option);
746
747 if (strcmp(defel->defname, "active_statements") == 0)
748 {
749 if (dactivelimit)
750 ereport(ERROR,
751 (errcode(ERRCODE_SYNTAX_ERROR),
752 errmsg("conflicting or redundant options")));
753 dactivelimit = defel;
754 }
755 else if (strcmp(defel->defname, "max_cost") == 0)
756 {
757 if (dcostlimit)
758 ereport(ERROR,
759 (errcode(ERRCODE_SYNTAX_ERROR),
760 errmsg("conflicting or redundant options")));
761 dcostlimit = defel;

Callers 1

standard_ProcessUtilityFunction · 0.85

Calls 15

superuserFunction · 0.85
defGetInt64Function · 0.85
defGetNumericFunction · 0.85
defGetBooleanFunction · 0.85
ScanKeyInitFunction · 0.85
CStringGetDatumFunction · 0.85
systable_beginscanFunction · 0.85
systable_getnextFunction · 0.85
systable_endscanFunction · 0.85
Float4GetDatumFunction · 0.85
BoolGetDatumFunction · 0.85
GetNewOidForResQueueFunction · 0.85

Tested by

no test coverage detected