From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Wieck <janwieck(at)Yahoo(dot)com> |
Cc: | josh(at)agliodbs(dot)com, sqllist <pgsql-sql(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: [SQL] PL/PGSQL function with parameters |
Date: | 2001-02-08 15:10:39 |
Message-ID: | 11921.981645039@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-02-08 15:33:47 | Re: Re: preproc.y error |
Previous Message | Tom Lane | 2001-02-08 15:03:55 | Re: [SQL] Re: PL/pgsql EXECUTE 'SELECT INTO ...' |
From | Date | Subject | |
---|---|---|---|
Next Message | Brice Ruth | 2001-02-08 15:55:08 | Query never returns ... |
Previous Message | Tom Lane | 2001-02-08 15:03:55 | Re: [SQL] Re: PL/pgsql EXECUTE 'SELECT INTO ...' |