Search Postgresql Archives

Re: Isolating a record column from a PL-Pgsql function call ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gauthier, Dave <dave.gauthier@xxxxxxxxx> schrieb:

> Hi:
> 
>  
> 
> I have a PL-Pgsql function that returns a record of a type that have 4 elements
> (columns).  Let’s say the first element/column is called “id_num”.  Is there a
> way I can specify the id_num element of the record returned from iside a query?
> 
>  
> 
> For example, select col1 from thetable where my_plpgsql_fn(col2).id_num = 123;

Okay, i think, i got it:

test=# create function x(in int, out a int, out b int) returns record as $$begin a:=1;b:=2;return; end; $$language plpgsql;
CREATE FUNCTION
Time: 0.412 ms

test=*# select 5 where 3=(select b from x(2));
 ?column?
----------
(0 rows)

Time: 0.335 ms
test=*# select 5 where 2=(select b from x(2));
 ?column?
----------
        5
(1 row)



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux