Thread: Small fix for _copySetConstraintsStmt

Small fix for _copySetConstraintsStmt

From
Fernando Nasser
Date:
Field is a list of strings, not nodes.

--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9Index: src/backend/nodes/copyfuncs.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v
retrieving revision 1.166
diff -c -p -r1.166 copyfuncs.c
*** src/backend/nodes/copyfuncs.c    2002/03/06 20:34:47    1.166
--- src/backend/nodes/copyfuncs.c    2002/03/07 12:49:58
*************** _copyConstraintsSetStmt(ConstraintsSetSt
*** 2495,2501 ****
  {
      ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);

!     Node_Copy(from, newnode, constraints);
      newnode->deferred = from->deferred;

      return newnode;
--- 2495,2501 ----
  {
      ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);

!     newnode->constraints = listCopy(from->constraints);
      newnode->deferred = from->deferred;

      return newnode;

Re: Small fix for _copySetConstraintsStmt

From
Tom Lane
Date:
Fernando Nasser <fnasser@redhat.com> writes:
> Field is a list of strings, not nodes.

Yeah, but listCopy is not the solution, because it'd only copy the cons
cells and not the pointed-to strings.  The representation of
ConstraintsSetStmt is really just plain broken.  It should use a list
of Value string nodes --- which would make copySetConstraintsStmt okay
as-is.  Fixing now...

            regards, tom lane

Re: Small fix for _copySetConstraintsStmt

From
Tom Lane
Date:
Fernando Nasser <fnasser@redhat.com> writes:
> Field is a list of strings, not nodes.

I fixed this by fixing the representation of ConstraintsSetStmt.
copyfuncs.c does not need to change.

            regards, tom lane