> 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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl