How to get the requested columns in a rowtype PL/pgSQL function

From: Federico Pedemonte <fepede(at)email(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: How to get the requested columns in a rowtype PL/pgSQL function
Date: 2004-01-19 14:41:00
Message-ID: 20040119144100.GC19466@protciv14.cmirl.arpal.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Imagine I have a PL/pgSQL function called myfunction that returns a
rowtype like this

CREATE TYPE mytype AS (a integer, b integer, c integer);

Imagine that I often need only 1 or 2 of this values, just say I need to
do query like these :

select a from myfunction()
select a,c from myfunction()
select b,c from myfunction()

and so on.

Now, since computing a,b and c could be expensive in term of time, is
there a way to understand (from withing the PL/pgSQL function) which
fields where requested in the query and then avoid computing those who
are not needed ?

Thanks in advance for every hints !

Ciao,
Federico.

Browse pgsql-general by date

  From Date Subject
Next Message Chris Smith 2004-01-19 15:03:18 Re: Very long time to commit or close connections
Previous Message Thierry Missimilly 2004-01-19 10:20:39 Re: Pass data of database Oracle to PostgreSQL