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

Function ATPrepAddColumn

src/backend/commands/tablecmds.c:8279–8294  ·  view source on GitHub ↗

* ALTER TABLE ADD COLUMN * * Adds an additional attribute to a relation making the assumption that * CHECK, NOT NULL, and FOREIGN KEY constraints will be removed from the * AT_AddColumn AlterTableCmd by parse_utilcmd.c and added as independent * AlterTableCmd's. * * ADD COLUMN cannot use the normal ALTER TABLE recursion mechanism, because we * have to decide at runtime whether to recurse o

Source from the content-addressed store, hash-verified

8277 * situations correctly.)
8278 */
8279static void
8280ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, bool recursing,
8281 bool is_view, AlterTableCmd *cmd, LOCKMODE lockmode,
8282 AlterTableUtilityContext *context)
8283{
8284 if (rel->rd_rel->reloftype && !recursing)
8285 ereport(ERROR,
8286 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
8287 errmsg("cannot add column to typed table")));
8288
8289 if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
8290 ATTypedTableRecursion(wqueue, rel, cmd, lockmode, context);
8291
8292 if (recurse && !is_view)
8293 cmd->subtype = AT_AddColumnRecurse;
8294}
8295
8296/*
8297 * Add a column to a table. The return value is the address of the

Callers 1

ATPrepCmdFunction · 0.85

Calls 3

ATTypedTableRecursionFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected