* 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
| 8277 | * situations correctly.) |
| 8278 | */ |
| 8279 | static void |
| 8280 | ATPrepAddColumn(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 |
no test coverage detected