pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: depstein@alliedtesting.com
Cc: pgsql-bugs@postgresql.org
Cc: pgagarinov@alliedtesting.com
Cc: vshahov@alliedtesting.com
Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL?
Date: Wed, 19 Oct 2011 16:45:58 -0400
Message-ID: <19518.1319057158@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHyXU0zEzSSrf3C4nzP3=LGbWhwjpKzL=xpTztUYrPPc3btKAg@mail.gmail.com>
References: <29F36C7C98AB09499B1A209D48EAA615B501DA9401@mail2a.alliedtesting.com>
	<201109061743.p86HhQX16354@momjian.us>
	<CA+TgmoazonH3XsKwCO1-MSpd+YnT48TpzcHjEJRJQDjkY1Y-AA@mail.gmail.com>
	<CAHyXU0zEzSSrf3C4nzP3=LGbWhwjpKzL=xpTztUYrPPc3btKAg@mail.gmail.com>

Merlin Moncure <mmoncure@gmail.com> writes:
> The point being, how do I convert any query to a non WITH variant so
> it can be PERFORM'd?  Anyways, I always thought having to do perform
> at all was pretty weak sauce -- not sure why it's required.

Possibly it was an Oracle compatibility thing ... anyone know PL/SQL
well enough to say how this works there?

I suppose you could argue that selecting a value and implicitly throwing
it away is confusing to novices, but on the other hand I've seen a whole
lot of novices confused by the need to write PERFORM instead of SELECT.
I think it wouldn't be an unreasonable thing to just interpret a SELECT
with no INTO clause as being a PERFORM (ie execute and discard results).
Then we'd not have to do anything magic for commands starting with WITH.

			regards, tom lane



view thread (24+ messages)  latest in thread

Message-ID: <19518.1319057158@sss.pgh.pa.us>
Permalink:  ../19518.1319057158@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19518.1319057158@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, robertmhaas@gmail.com, bruce@momjian.us, depstein@alliedtesting.com, pgagarinov@alliedtesting.com, vshahov@alliedtesting.com
  Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL?
  In-Reply-To: <19518.1319057158@sss.pgh.pa.us>
  References: <29F36C7C98AB09499B1A209D48EAA615B501DA9401@mail2a.alliedtesting.com> <201109061743.p86HhQX16354@momjian.us> <CA+TgmoazonH3XsKwCO1-MSpd+YnT48TpzcHjEJRJQDjkY1Y-AA@mail.gmail.com> <CAHyXU0zEzSSrf3C4nzP3=LGbWhwjpKzL=xpTztUYrPPc3btKAg@mail.gmail.com> <19518.1319057158@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