diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-22 14:22:14 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-22 14:22:14 +0000 |
commit | faebf2f8a2b805d905e5302018ec167e053eb181 (patch) | |
tree | 9870f95fcc05a1bbad029cc94fea309b863d2a38 /src/backend/commands/copy.c | |
parent | 530876fea5060cce019e522b05be81e0aa4d4507 (diff) | |
download | postgresql-faebf2f8a2b805d905e5302018ec167e053eb181.tar.gz postgresql-faebf2f8a2b805d905e5302018ec167e053eb181.zip |
Turn constraints off for sequences & views
elog(WARN,"ADD ATTRIBUTE: DEFAULT is not implemented, yet");
Call ExecConstraints in CopyFrom
Diffstat (limited to 'src/backend/commands/copy.c')
-rw-r--r-- | src/backend/commands/copy.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index ee7948ac425..5fb94874256 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.26 1997/08/19 04:43:28 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.27 1997/08/22 14:22:09 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -608,15 +608,18 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) * ---------------- */ - if (rel->rd_att->constr && rel->rd_att->constr->has_not_null) - { - int attrChk; - for (attrChk = 1; attrChk <= rel->rd_att->natts; attrChk++) { - if (rel->rd_att->attrs[attrChk-1]->attnotnull && heap_attisnull(tuple,attrChk)) - elog(WARN,"CopyFrom: Fail to add null value in not null attribute %s", - rel->rd_att->attrs[attrChk-1]->attname.data); - } - } + if ( rel->rd_att->constr ) + { + HeapTuple newtuple; + + newtuple = ExecConstraints ("CopyFrom", rel, tuple); + + if ( newtuple != tuple ) + { + pfree (tuple); + tuple = newtuple; + } + } heap_insert(rel, tuple); |