From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | WIP: hooking parser |
Date: | 2009-02-11 10:05:03 |
Message-ID: | 162867790902110205s7878330ax67a7e6f2bdbeb53@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
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.
I did small example - real implementation of Oracle's decode function.
It's based on hooking transformExpr function.
It works. And I thing, this should to solve lot of special task
related to increase compatibility with Oracle, Informix, or it could
be usefull for some others (json support).
postgres=# load 'decode';
LOAD
postgres=# select
decode(null::integer,2,'ahoj',3,'Petr',1,'Pavel',null, 'jaja');
decode
--------
jaja
(1 row)
postgres=# select decode(3,2,'ahoj',3,'Petr',1,'Pavel',null, 'jaja');
decode
--------
Petr
(1 row)
postgres=# select decode(6,2,'ahoj',3,'Petr',1,'Pavel',null, 'jaja');
decode
--------
(1 row)
postgres=# select decode(6,2,'ahoj',3,'Petr',1,'Pavel',null, 'jaja', 'Milos');
decode
--------
Milos
(1 row)
Any ideas, notes?
regards
Pavel Stehule
Attachment | Content-Type | Size |
---|---|---|
decode.c | text/plain | 4.5 KB |
parse_expr.diff | text/x-patch | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2009-02-11 10:07:39 | Re: temporarily stop autovacuum |
Previous Message | Tatsuo Ishii | 2009-02-11 09:39:23 | Re: DISCARD ALL failing to acquire locks on pg_listen |