Re: Questions about parser code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Questions about parser code
Date: 2007-01-30 16:53:42
Message-ID: 3172.1170176022@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Is it ok to scribble on and reuse objects from the parse tree when generating
> the transformed tree? Or should the transformed query object be built from
> freshly allocated nodes?

We do both already; take your pick. If you do the former, though,
I suggest designing the code so that it's a no-op on an
already-transformed node. It used to be the case that the grammar
could generate multiple references to the same subtree (e.g., by
transforming "x BETWEEN y AND z" to "x >= y AND x <= z") and I'm not
sure we have removed all such shortcuts.

There's some logical cleaniness to using different node types for raw
and transformed trees, but when there's a simple one-for-one
correspondence this is probably overkill.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-01-30 16:56:07 Re: standard_conforming_strings 'on' for 8.3?
Previous Message J. Andrew Rogers 2007-01-30 16:53:23 Re: pgsql: Fix for plpython functions; return true/false for boolean,