[EMAIL PROTECTED] writes: > I've got one of these: > SELECT * from some_table WHERE > test_for_equality_is_syntactically_ugly; > What I'd like to do is encapsulate the WHERE clause in a function,
You mean like replacing SELECT * from some_table WHERE x = 42 AND y = 77 with create function mytest(int,int) returns bool as $$select $1 = 42 AND $2 = 77$$ language sql; SELECT * from some_table WHERE mytest(x,y); A SQL-language function like this should get inlined into the query, so that you don't lose any performance compared to writing out the full expression each time. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org