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

Non-trivial rewriting sql query

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: <JanWieck(at)Yahoo(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Non-trivial rewriting sql query
Date: 2001-06-27 08:17:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

we're thinking about possibility to integrate our full-text search
into postgres. There are several problems we should thinking about
but for now we have a question about rewrite system.

Is't possible to rewrite SQL query and execute it. Currently we build
sql query outside of postgres using perl.

Let's consider some simple example:

create table tst ( a int4, b int4, c int4);

    select * from tst where a=2 and c=0;

we need something like:

    select * from tst where str and c=0;

where str is a string resulting by call ourfunc(table.a, 2)
and looks like  'b=2*2 or b=(2-1)'

i.e. instead of original select we need to execute rewritten select

    select * from tst where (b=2*2 or b=(2-1)) and c=0;

in other words we need to know is't possible to recognise
(operator, field,table) and rewrite part of sql by
result of calling of ourfunc().

We're not sure if it's a question of rewrite system though.

Any pointers where to go would be very nice.




pgsql-hackers by date

Next:From: Zeugswetter Andreas SBDate: 2001-06-27 08:35:23
Subject: AW: functions returning records
Previous:From: Karel ZakDate: 2001-06-27 07:10:52
Subject: Re: functions returning records

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group