Re: Questions about parser code
| От | Tom Lane |
|---|---|
| Тема | Re: Questions about parser code |
| Дата | |
| Msg-id | 3172.1170176022@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Questions about parser code (Gregory Stark <stark@enterprisedb.com>) |
| Ответы |
Re: Questions about parser code
|
| Список | pgsql-hackers |
Gregory Stark <stark@enterprisedb.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
В списке pgsql-hackers по дате отправления: