Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 651e31b

Browse files
author
Thomas G. Lockhart
committed
Fix up crashing symptoms for new serial type by making sure constraint
and index name fields are pstrdup'd (copied) rather than reused.
1 parent a873da4 commit 651e31b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/parser/analyze.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.81 1998/08/25 15:08:12 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.82 1998/08/26 04:20:27 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -518,7 +518,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
518518
}
519519

520520
sequence = makeNode(CreateSeqStmt);
521-
sequence->seqname = constraint->name;
521+
sequence->seqname = pstrdup(constraint->name);
522522
sequence->options = NIL;
523523

524524
elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",
@@ -528,6 +528,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
528528

529529
constraint = makeNode(Constraint);
530530
constraint->contype = CONSTR_UNIQUE;
531+
constraint->name = makeTableName(stmt->relname, column->colname, "key", NULL);
531532

532533
column->constraints = lappend(column->constraints, constraint);
533534
}

0 commit comments

Comments
 (0)