From: | John DeSoi <desoi(at)pgedit(dot)com> |
---|---|
To: | Jan Meyland Andersen <jma(at)agile(dot)dk> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Some help with functions-syntax |
Date: | 2007-01-18 13:47:19 |
Message-ID: | 603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Barbara Cosentino | 2007-01-18 23:51:12 | Help ... Unexpected results when using limit/offset with select statement..DB corruption? |
Previous Message | Jan Meyland Andersen | 2007-01-18 07:38:56 | Re: Some help with functions-syntax |