Thread: Documentation of Implicit Function Call /w Composite Types

Documentation of Implicit Function Call /w Composite Types

From
"David Johnston"
Date:

With Chris Travers recently going O-R gung-ho on us I decided I wanted to find out where in the documentation the following behavior is specified:

 

The expression:

 

(some_composite).calculated_field

 

resolves to the function call:

 

calculated_field(some_composite)

 

I know I’ve seen it before, though whether in the docs or in e-mail I am unsure, but for the life of me browsing for it for about 10 minutes got me nowhere – and I am not sure how to construct a meaningful search which would be a secondary means to discover the information IMO.

 

I am beginning to see the value in having such a syntax but it seems unusual enough that if it is indeed as powerful as Chris is discovering I would think finding and espousing on its existence/features in the documentation would be important.  Given that it has to do with functions and composite types it should probably appear in both (and Advanced Features even) with cross-references between the various locations.

 

Thoughts/Comments/Directions?


Thanks!

 

David J

 

Re: Documentation of Implicit Function Call /w Composite Types

From
Merlin Moncure
Date:
On Mon, Aug 27, 2012 at 3:46 PM, David Johnston <polobo@yahoo.com> wrote:
> With Chris Travers recently going O-R gung-ho on us I decided I wanted to
> find out where in the documentation the following behavior is specified:
>
> The expression:
>
> (some_composite).calculated_field
>
> resolves to the function call:
>
> calculated_field(some_composite)
>
> I know I’ve seen it before, though whether in the docs or in e-mail I am
> unsure, but for the life of me browsing for it for about 10 minutes got me
> nowhere – and I am not sure how to construct a meaningful search which would
> be a secondary means to discover the information IMO.
>
> I am beginning to see the value in having such a syntax but it seems unusual
> enough that if it is indeed as powerful as Chris is discovering I would
> think finding and espousing on its existence/features in the documentation
> would be important.  Given that it has to do with functions and composite
> types it should probably appear in both (and Advanced Features even) with
> cross-references between the various locations.
>
> Thoughts/Comments/Directions?

Tom broke it down here (the whole thread is worth reading, but
particularly this mail):
http://archives.postgresql.org/pgsql-bugs/2010-10/msg00269.php.

It's legacy functionality dating to the QUEL days.

merlin


Re: Documentation of Implicit Function Call /w Composite Types

From
Tom Lane
Date:
"David Johnston" <polobo@yahoo.com> writes:
> The expression:
> (some_composite).calculated_field
> resolves to the function call:
> calculated_field(some_composite)

> I know I've seen it before, though whether in the docs or in e-mail I am
> unsure, but for the life of me browsing for it for about 10 minutes got me
> nowhere - and I am not sure how to construct a meaningful search which would
> be a secondary means to discover the information IMO.

In recent versions of the docs it's mentioned at the end of section
4.2.6 "Function Calls":
http://www.postgresql.org/docs/devel/static/sql-expressions.html#AEN1902

which links to some info down near the end of section 35.4.3:
http://www.postgresql.org/docs/devel/static/xfunc-sql.html#XFUNC-SQL-COMPOSITE-FUNCTIONS

            regards, tom lane