Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Questions about parser code



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group