Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f18FAkx89312; Thu, 8 Feb 2001 10:10:46 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f18FAd911924; Thu, 8 Feb 2001 10:10:40 -0500 (EST) To: Jan Wieck cc: josh@agliodbs.com, sqllist , pgsql-hackers@postgresql.org Subject: Re: Re: [SQL] PL/PGSQL function with parameters In-reply-to: <200102081137.GAA03502@jupiter.greatbridge.com> References: <200102081137.GAA03502@jupiter.greatbridge.com> Comments: In-reply-to Jan Wieck message dated "Thu, 08 Feb 2001 06:37:22 -0500" Date: Thu, 08 Feb 2001 10:10:39 -0500 Message-ID: <11921.981645039@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200102/274 X-Sequence-Number: 4405 > 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