Keep relations open until they are no longer needed.
authorHiroshi Inoue <inoue@tpf.co.jp>
Mon, 8 Jan 2001 03:14:58 +0000 (03:14 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Mon, 8 Jan 2001 03:14:58 +0000 (03:14 +0000)
src/backend/commands/command.c

index d3a00753e56af1fc6ea822a69f42c35b0b410a25..d1f595eed84152d993e8da47d4d9b7a4cd5af8a6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.115 2001/01/07 00:05:22 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.116 2001/01/08 03:14:58 inoue Exp $
  *
  * NOTES
  *   The PerformAddAttribute() code, like most of the relation
@@ -1195,10 +1195,10 @@ AlterTableAddConstraint(char *relationName,
                    pfree(slot);
 
                    heap_endscan(scan);
-                   heap_close(rel, NoLock);
 
                    if (!successful)
                    {
+                       heap_close(rel, NoLock);
                        elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name);
                    }
                    /*
@@ -1208,6 +1208,7 @@ AlterTableAddConstraint(char *relationName,
                     * the table.
                     */
                    AddRelationRawConstraints(rel, NIL, constlist);
+                   heap_close(rel, NoLock);
                    pfree(constlist);
 
                    break;