Running query from scratch with something like exec function?
is it possible to make something similar to the following with Postgresql without using a function?
pseudo sql code:
select * from sometable where somecol = somevalue AND someothercol IN exec( 'select something from exclusionlist' )
My primary intention is to build up a table with predefined queries to call inside a where clause
pseudo sql code: select * from sometable where somecol = somevalue AND someothercol IN exec( select query f开发者_运维技巧rom predefinedqueries where id=someid )
As far as I can see the only option is:
prepare my_usr_id as select usr_id from usr where usr_id < $1;
create temp table my_temp on commit drop as execute my_usr_id(10);
select * from usr join my_temp using (usr_id);
精彩评论