pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <janwieck@Yahoo.com>
Cc: josh@agliodbs.com, sqllist <pgsql-sql@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [SQL] PL/PGSQL function with parameters
Date: Thu, 08 Feb 2001 10:10:39 -0500
Message-ID: <11921.981645039@sss.pgh.pa.us> (raw)
In-Reply-To: <200102081137.GAA03502@jupiter.greatbridge.com>
References: <200102081137.GAA03502@jupiter.greatbridge.com>

> Josh Berkus wrote:
>> If you think that's the best way.  What we're really all wanting is a wy
>> in PL/pgSQL to pass a parameter as an object name.  Doing it *without*
>> using EXECUTE would be even better than modifying EXECUTE to accomdate
>> SELECT ... INTO variable.
>> 
>> If we can write queries that address tables by OID, that would give us a
>> quick workaround ... get the OID from pg_class, then pass it to the
>> query as variables of type OID:
>> 
>> SELECT column1_oid, column2_oid FROM table_oid
>> WHERE column2_oid = variable1
>> ORDER BY column1_oid;

This is completely pointless, AFAICS.  If you don't know what table
is to be selected from, then you can't do *any* semantic checking or
planning in advance, so you might as well just do the entire processing
at runtime.  That's exactly what EXECUTE does.  I don't see any
functional advantage in an intermediate step between plpgsql's normal
behavior (caching of query plans) and EXECUTE.  If it bought some
readability over constructing a query string for EXECUTE, then maybe,
but dealing in table and column OIDs is not my idea of a pleasant or
readable way to program ...

			regards, tom lane



view thread (15+ messages)  latest in thread

Message-ID: <11921.981645039@sss.pgh.pa.us>
Permalink:  ../11921.981645039@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11921.981645039@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, janwieck@Yahoo.com, pgsql-hackers@postgresql.org
  Subject: Re: [SQL] PL/PGSQL function with parameters
  In-Reply-To: <11921.981645039@sss.pgh.pa.us>
  References: <200102081137.GAA03502@jupiter.greatbridge.com> <11921.981645039@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