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

Function ATSimplePermissions

src/backend/commands/tablecmds.c:7790–7858  ·  view source on GitHub ↗

* ATSimplePermissions * * - Ensure that it is a relation (or possibly a view) * - Ensure this user is the owner * - Ensure that it is not a system table */

Source from the content-addressed store, hash-verified

7788 * - Ensure that it is not a system table
7789 */
7790static void
7791ATSimplePermissions(Relation rel, int allowed_targets)
7792{
7793 int actual_target;
7794
7795 switch (rel->rd_rel->relkind)
7796 {
7797 case RELKIND_RELATION:
7798 case RELKIND_PARTITIONED_TABLE:
7799 actual_target = ATT_TABLE;
7800 break;
7801 case RELKIND_VIEW:
7802 actual_target = ATT_VIEW;
7803 break;
7804 case RELKIND_MATVIEW:
7805 actual_target = ATT_MATVIEW;
7806 break;
7807 case RELKIND_INDEX:
7808 actual_target = ATT_INDEX;
7809 break;
7810 case RELKIND_PARTITIONED_INDEX:
7811 actual_target = ATT_PARTITIONED_INDEX;
7812 break;
7813 case RELKIND_COMPOSITE_TYPE:
7814 actual_target = ATT_COMPOSITE_TYPE;
7815 break;
7816 case RELKIND_FOREIGN_TABLE:
7817 actual_target = ATT_FOREIGN_TABLE;
7818 break;
7819 case RELKIND_DIRECTORY_TABLE:
7820 actual_target = ATT_DIRECTORY_TABLE;
7821 break;
7822 case RELKIND_SEQUENCE:
7823 actual_target = ATT_SEQUENCE;
7824 break;
7825
7826 case RELKIND_AOSEGMENTS:
7827 case RELKIND_AOBLOCKDIR:
7828 case RELKIND_AOVISIMAP:
7829 /*
7830 * Allow ALTER TABLE operations in standard alone mode on
7831 * AO segment tables.
7832 */
7833 if (IsUnderPostmaster)
7834 actual_target = ATT_TABLE;
7835 else
7836 actual_target = 0;
7837 break;
7838
7839 default:
7840 actual_target = 0;
7841 break;
7842 }
7843
7844 /* Wrong target type? */
7845 if ((actual_target & allowed_targets) == 0)
7846 ATWrongRelkindError(rel, allowed_targets);
7847

Callers 7

ATPrepCmdFunction · 0.85
ATExecAddColumnFunction · 0.85
ATExecDropColumnFunction · 0.85
ATAddCheckConstraintFunction · 0.85
ATExecDropConstraintFunction · 0.85
ATExecAddInheritFunction · 0.85
ATExecAttachPartitionFunction · 0.85

Calls 8

ATWrongRelkindErrorFunction · 0.85
pg_class_ownercheckFunction · 0.85
GetUserIdFunction · 0.85
aclcheck_errorFunction · 0.85
get_relkind_objtypeFunction · 0.85
IsSystemRelationFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected