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

Function ATPrepDropNotNull

src/backend/commands/tablecmds.c:8973–8991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8971 */
8972
8973static void
8974ATPrepDropNotNull(Relation rel, bool recurse, bool recursing)
8975{
8976 /*
8977 * If the parent is a partitioned table, like check constraints, we do not
8978 * support removing the NOT NULL while partitions exist.
8979 */
8980 if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
8981 {
8982 PartitionDesc partdesc = RelationGetPartitionDesc(rel, true);
8983
8984 Assert(partdesc != NULL);
8985 if (partdesc->nparts > 0 && !recurse && !recursing)
8986 ereport(ERROR,
8987 (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
8988 errmsg("cannot remove constraint from only the partitioned table when partitions exist"),
8989 errhint("Do not specify the ONLY keyword.")));
8990 }
8991}
8992
8993/*
8994 * Return the address of the modified column. If the column was already

Callers 1

ATPrepCmdFunction · 0.85

Calls 4

RelationGetPartitionDescFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected