Re: WIP: hooking parser

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: hooking parser
Date: 2009-02-11 16:54:39
Message-ID: 162867790902110854l662e727cic2d563b2f853e14b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/2/11 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> some years ago there was some plans about parser's extensibility. I am
>> able write bison extensions, but I thing, so lot of work should be
>> done via hooking of transform stage.
>
> This strikes me as next door to useless, because it can only handle
> things that look like valid expressions to the existing grammar.
> So pretty much all you can do is weird sorts of functions, which are
> already accommodated at less effort with existing features such as
> function overloading.

Usually we don't need change syntax. But we need to control of
coercion stage. I afraid so function overloading is bad when there lot
of combination, and polymorphic functions are not enough.

for some cases we need more polymorphic types - anyelement1,
anyelement2, anyarray1, ...

>
> A hook check in that particular place is not going to have negligible
> performance impact, since it's going to be hit tens or hundreds or
> thousands of times per query rather than just once. So it's going to
> require more than a marginal use case to persuade me we ought to have
> it.

Because this stage isn't repeated (I don't expect bigger performance
impact), it's similar to other's hooks. But, sure, wrong hook should
do strange things. It's risk.

+ argument - it increase customisability and allows gentle syntax
tuning. Function decode is first sample from today morning.

regards
Pavel Stehule

>
> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-02-11 16:55:01 Re: WIP: fix SET WITHOUT OIDS, add SET WITH OIDS
Previous Message Stephen Frost 2009-02-11 16:50:32 Re: Optimization rules for semi and anti joins