Re: Some help with functions-syntax

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Some help with functions-syntax
Дата
Msg-id 603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com
обсуждение исходный текст
Ответ на Re: Some help with functions-syntax  ("Jan Meyland Andersen" <jma@agile.dk>)
Список 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Jan Meyland Andersen"
Дата:
Сообщение: Re: Some help with functions-syntax
Следующее
От: "Barbara Cosentino"
Дата:
Сообщение: Help ... Unexpected results when using limit/offset with select statement..DB corruption?