From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: WIP: hooking parser |
Date: | 2009-02-16 19:03:42 |
Message-ID: | 162867790902161103l140be0cawcc015280fb58a9b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/2/16 Sam Mason <sam(at)samason(dot)me(dot)uk>:
> On Mon, Feb 16, 2009 at 04:40:23PM +0100, Pavel Stehule wrote:
>> 2009/2/16 Sam Mason <sam(at)samason(dot)me(dot)uk>:
>> > On Mon, Feb 16, 2009 at 03:21:12PM +0100, Pavel Stehule wrote:
>> >> so these modules (decode, oraemptystr) decrease differences between
>> >> PostgreSQL and Oracle.
>> >
>> > wouldn't it be better/easier to extend something like pgpool to
>> > transform Oracle style SQL code to PG style code? You'd certainly
>> > be able to get it more complete in reasonable amounts of time, but
>> > performance would suffer when you went to look up table definitions to
>> > check the types of various things.
>>
>> then you should to rewrite complete PostgreSQL parser :) and
>> performance will be worse (you have to parse query string two times).
>
> Yes, there'd be a few thousand lines of code to write.
>
> Note that you only need to parse things twice, planning only needs to be
> done by PG, so it shouldn't be too bad. It'll add maybe a millisecond
> or so to query execution times, with most of that time spent going off
> to find table and function definitions from the real database.
Hello
>
> But to do it properly inside PG would be difficult; how would your hooks
> know to transform:
>
> SELECT s FROM foo WHERE s IS NULL;
>
> into:
>
> SELECT s FROM foo WHERE (s = '' OR s IS NULL);
I don't need it. Oracle store NULL without ''. So expression some IS
NULL is stable.
>
> that all looks a bit tricky to me. Hum... actually it's not. All you
> need to do is to rewrite any string reference "s" into NULLIF(s,'').
> That would tank performance as indexes wouldn't be used most of the
> time, but never mind.
>
look to source what I do. It' just simple. But you have to emulate
Oracle behave everywhere. Then all is simple, because Oracle doesn't
know ''.
>
> That would be a *much* bigger change; you're actually changing PG's
> parser there and not just modifying the parse tree. If it was done
> externally it would be a much easier thing to do.
>
No I don't do it. Loadable modules are really external. I need only
hook inside parser.
Regards
Pavel Stehule
> --
> Sam http://samason.me.uk/
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2009-02-16 19:33:15 | Re: WIP: hooking parser |
Previous Message | Martin Rusoff | 2009-02-16 18:41:43 | Re: SE-PostgreSQL and row level security |