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> writes:
> 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;

You're just missing some parentheses:

select col1 from thetable where (my_plpgsql_fn(col2)).id_num = 123;

as indeed is documented here:
http://www.postgresql.org/docs/8.3/static/sql-expressions.html#AEN1679

There are messy syntactic reasons for requiring these parens, which
I don't recall the details of at the moment ...

			regards, tom lane

-- 
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