Re: [HACKERS] serial type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Michael Simms <grim(at)argh(dot)demon(dot)co(dot)uk>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] serial type
Date: 1999-09-14 14:39:44
Message-ID: 16320.937319984@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
>> I am not sure if this is a mistake in the construction of the parsetree
>> (Thomas, what do you think?) or if the node print functions need to be
>> modified. I think it'd be easiest to alter the parsetree, though.
>> Perhaps the UNIQUE constraint ought to be attached somewhere else.

> If I understand the problem correctly, the "column name" field in the
> constraint clause attached to the column node is being used to look up
> the column node, resulting in a recursive infinite loop. Or is
> something else happening with direct pointers back to a parent node?

The problem is with direct pointers in the parse tree: the column
node has a list of constraint nodes attached to it, and the UNIQUE
node in that list has a keys field that points at the column node.
The node print routines try to recurse through this structure, and
of course it's a never-ending recursion.

BTW, it's not only SERIAL that causes the problem; plain old
create table z2 (f1 int4 unique);
will crash the backend if you start psql with PGOPTIONS="-d5".

As I said, I'm not sure if the answer is to change the parsetree
representation, or to try to make node print/read smarter about
this looping structure. But I'd incline to the first --- the
looped structure puts all sorts of tree-traversal algorithms at
risk.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-14 14:53:09 Re: [HACKERS] Patch for user-defined C-language functions
Previous Message Thomas Lockhart 1999-09-14 14:38:09 Re: [HACKERS] ISO dates with European Format