Fix likely cause of rare ALTER TABLE ADD FOREIGN KEY failures ---
authorTom Lane
Thu, 12 Sep 2002 21:16:42 +0000 (21:16 +0000)
committerTom Lane
Thu, 12 Sep 2002 21:16:42 +0000 (21:16 +0000)
don't assume relname field of a relcache entry will stay valid across
lots of operations.

src/backend/commands/tablecmds.c

index 7b49ba720aac69408a42aa429898140dcae3cfa5..380287caa37bad6b116f2ca6977ecad63bff0437 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.40 2002/09/06 00:01:53 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.41 2002/09/12 21:16:42 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2920,7 +2920,7 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
     * unfortunately).
     */
    myRel = makeRangeVar(get_namespace_name(RelationGetNamespace(rel)),
-                        RelationGetRelationName(rel));
+                        pstrdup(RelationGetRelationName(rel)));
 
    /*
     * Preset objectAddress fields