On Jan 18, 2007, at 2:38 AM, Jan Meyland Andersen wrote:
But the problem here is that the where-clause depends on the
relkind. That
is why I'm trying to solve the problem this way.
I think that clause can be written as a subselect and added to the
expression. Or just make that a separate function and AND the
function call with your query expression.
How do I then write EXECUTE queries on multiple lines, if I go with
this
solution?
You can make it a big multi-line string. Or you can build the string,
something like:
declare
_sql
begin
_sql := _sql + 'select ...'
_sql := _sql + ' where ...'
But using the form without execute is much better. PostgreSQL will
only have to plan the query the first time it is called. Using
EXECUTE is much less efficient.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend