* Add a pre-cooked default expression. * * Return the address of the affected column. */
| 9458 | * Return the address of the affected column. |
| 9459 | */ |
| 9460 | static ObjectAddress |
| 9461 | ATExecCookedColumnDefault(Relation rel, AttrNumber attnum, |
| 9462 | Node *newDefault) |
| 9463 | { |
| 9464 | ObjectAddress address; |
| 9465 | |
| 9466 | /* We assume no checking is required */ |
| 9467 | |
| 9468 | /* |
| 9469 | * Remove any old default for the column. We use RESTRICT here for |
| 9470 | * safety, but at present we do not expect anything to depend on the |
| 9471 | * default. (In ordinary cases, there could not be a default in place |
| 9472 | * anyway, but it's possible when combining LIKE with inheritance.) |
| 9473 | */ |
| 9474 | RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, false, |
| 9475 | true); |
| 9476 | |
| 9477 | (void) StoreAttrDefault(rel, attnum, newDefault, |
| 9478 | NULL, NULL, NULL, /* missing val stuff */ |
| 9479 | true, false); |
| 9480 | |
| 9481 | ObjectAddressSubSet(address, RelationRelationId, |
| 9482 | RelationGetRelid(rel), attnum); |
| 9483 | return address; |
| 9484 | } |
| 9485 | |
| 9486 | /* |
| 9487 | * ALTER TABLE ALTER COLUMN ADD IDENTITY |
no test coverage detected