From a4a232b1e70229a6ba0e592f6775c019bb171d9a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 22 Aug 2018 08:42:49 +0200 Subject: Error position support for defaults and check constraints Add support for error position reporting for the expressions contained in defaults and check constraint definitions. This currently works only for CREATE TABLE, not ALTER TABLE, because the latter is not set up to pass around the original query string. Reviewed-by: Fabien COELHO --- src/backend/commands/tablecmds.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/backend/commands') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 2a12d64aeb..552ad8c592 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -985,7 +985,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, */ if (rawDefaults || stmt->constraints) AddRelationNewConstraints(rel, rawDefaults, stmt->constraints, - true, true, false); + true, true, false, queryString); ObjectAddressSet(address, RelationRelationId, relationId); @@ -5587,7 +5587,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, * _list_ of defaults, but we just do one. */ AddRelationNewConstraints(rel, list_make1(rawEnt), NIL, - false, true, false); + false, true, false, NULL); /* Make the additional catalog changes visible */ CommandCounterIncrement(); @@ -6178,7 +6178,7 @@ ATExecColumnDefault(Relation rel, const char *colName, * _list_ of defaults, but we just do one. */ AddRelationNewConstraints(rel, list_make1(rawEnt), NIL, - false, true, false); + false, true, false, NULL); } ObjectAddressSubSet(address, RelationRelationId, @@ -7215,7 +7215,8 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, list_make1(copyObject(constr)), recursing | is_readd, /* allow_merge */ !recursing, /* is_local */ - is_readd); /* is_internal */ + is_readd, /* is_internal */ + NULL); /* queryString not available here */ /* we don't expect more than one constraint here */ Assert(list_length(newcons) <= 1); -- cgit v1.2.1