pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Sydney-Smith <richard@ibisaustralia.com>
Cc: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How do I replace select ... into commands?
Date: Thu, 11 Sep 2003 23:20:07 -0400
Message-ID: <6095.1063336807@sss.pgh.pa.us> (raw)
In-Reply-To: <001d01c378d9$d8a8bfc0$df6c32d2@athlon2000>
References: <20030911194512.Q47864-100000@megazone.bigpanda.com>
	<001d01c378d9$d8a8bfc0$df6c32d2@athlon2000>

"Richard Sydney-Smith" <richard@ibisaustralia.com> writes:
>       execute ''select max('' || seq_fld || '') into mx from '' || tbl;

You can't use INTO in an EXECUTE'd select (basically because the string
to be executed is not processed by plpgsql at all, merely sent down to
the SQL engine, which does not know the output variable mx).  The way to
get results out of an executed select is to use FOR ... IN EXECUTE.
Which is a kluge, but it holds the fort until someone gets around to
redesigning this code.  See the manual.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <6095.1063336807@sss.pgh.pa.us>
Permalink:  ../6095.1063336807@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6095.1063336807@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, richard@ibisaustralia.com, sszabo@megazone.bigpanda.com
  Subject: Re: How do I replace select ... into commands?
  In-Reply-To: <6095.1063336807@sss.pgh.pa.us>

* 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