Commit faebf2f8 authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Turn constraints off for sequences & views

elog(WARN,"ADD ATTRIBUTE: DEFAULT is not implemented, yet");
Call ExecConstraints in CopyFrom
parent 530876fe
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.12 1997/08/21 03:01:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.13 1997/08/22 14:22:07 vadim Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
......@@ -283,7 +283,9 @@ PerformAddAttribute(char *relationName,
* we can't add a not null attribute
*/
if (colDef->is_not_null)
elog(WARN,"Can't add a not null attribute to a existent relation");
elog(WARN,"Can't add a not null attribute to a existent relation");
if (colDef->defval)
elog(WARN,"ADD ATTRIBUTE: DEFAULT is not implemented, yet");
/*
* if the first element in the 'schema' list is a "*" then we are
* supposed to add this attribute to all classes that inherit from
......
......@@ -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);
......
......@@ -97,6 +97,8 @@ DefineSequence (CreateSeqStmt *seq)
typnam->arrayBounds = NULL;
coldef = makeNode(ColumnDef);
coldef->typename = typnam;
coldef->defval = NULL;
coldef->is_not_null = false;
null[i-1] = ' ';
switch (i)
......@@ -149,6 +151,7 @@ DefineSequence (CreateSeqStmt *seq)
stmt->archiveLoc = -1; /* default */
stmt->archiveType = ARCH_NONE;
stmt->inhRelnames = NIL;
stmt->constraints = NIL;
ItsSequenceCreation = true; /* hack */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.7 1997/01/10 20:17:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.8 1997/08/22 14:22:14 vadim Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -77,6 +77,9 @@ DefineVirtualRelation(char *relname, List *tlist)
def->colname = pstrdup(resname);
def->typename = typename;
def->is_not_null = false;
def->defval = (char*) NULL;
attrList = lappend(attrList, def);
}
......@@ -95,6 +98,7 @@ DefineVirtualRelation(char *relname, List *tlist)
createStmt.archiveType = ARCH_NONE;
createStmt.location = -1;
createStmt.archiveLoc = -1;
createStmt.constraints = NIL;
/*
* finally create the relation...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment