Re: calling a function that takes a row type and returns a set of rows - Mailing list pgsql-general

From Dimitri Fontaine
Subject Re: calling a function that takes a row type and returns a set of rows
Date
Msg-id 484C90C6-43AB-4696-BFFD-CD1F0C4272BB@hi-media.com
Whole thread Raw
In response to calling a function that takes a row type and returns a set of rows  ("Robert Haas" <robertmhaas@gmail.com>)
Responses Re: calling a function that takes a row type and returns a set of rows  ("Robert Haas" <robertmhaas@gmail.com>)
Re: calling a function that takes a row type and returns a set of rows  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Le 10 oct. 08 à 21:22, Robert Haas a écrit :
> I can't find any legal way of calling this function.
>
> SELECT bar(f) FROM foo f;
> ERROR:  set-valued function called in context that cannot accept a set
>
> SELECT * FROM foo f, bar(f);
> ERROR:  function expression in FROM may not refer to other relations
> of same query level
>
> Any help appreciated.


You need LATERAL support for this:
   SELECT * FROM foo f LATERAL bar(f);

I'm not sure about the syntax, but LATERAL is a standard JOIN type
wherein upper "nodes" are visible.
- --
dim

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkjvvYMACgkQlBXRlnbh1blatgCgnaDoSY2RGzv224QWqA8OYEjx
fbMAoK31dHoFjOVRdomvhl/qilndRZJ5
=3xjL
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "Robert Haas"
Date:
Subject: Re: calling a function that takes a row type and returns a set of rows
Next
From: Tom Lane
Date:
Subject: Re: Bug In COPY TO?