pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John DeSoi <desoi@pgedit.com>
To: Jan Meyland Andersen <jma@agile.dk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Some help with functions-syntax
Date: Thu, 18 Jan 2007 08:47:19 -0500
Message-ID: <603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com> (raw)
In-Reply-To: <62559.82.143.192.130.1169105936.squirrel@mail.agile.dk>
References: <1364.62.66.218.59.1169073199.squirrel@mail.agile.dk>
	<2AFADCD2-C72D-40FB-8B8E-D6FD023F2148@pgedit.com>
	<62559.82.143.192.130.1169105936.squirrel@mail.agile.dk>


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




view thread (4+ messages)

Message-ID: <603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com>
Permalink:  ../603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com/
Also on:    postgresql.org/message-id/603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: desoi@pgedit.com, jma@agile.dk
  Subject: Re: Some help with functions-syntax
  In-Reply-To: <603CB0E8-EFBD-4762-BC45-AFAD248E484B@pgedit.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox