AW: Non-trivial rewriting sql query

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB
Тема AW: Non-trivial rewriting sql query
Дата
Msg-id 11C1E6749A55D411A9670001FA68796336834D@sdexcsrv1.f000.d0188.sd.spardat.at
обсуждение исходный текст
Список pgsql-hackers
> 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;

Can you give us a real life example ? For me this is too abstract to 
understand.

Problem with the rewriter is, that it currently has no access to the
where restriction, and can thus only add restrictions without knowledge
of the where clause at hand. Of course you would also need to create
a view and replace the standard "on select" rule, and do your selects
on the view (unless the rewriter is extended to be invoked by a certain 
where clause (here a=2) and the rewritten query does not contain this 
clause).

Andreas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Reinoud van Leeuwen"
Дата:
Сообщение: Re: AW: functions returning records
Следующее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: Re: Encrypting pg_shadow passwords