Re: AS s(a) vs. AS a - Mailing list pgsql-general

From Tom Lane
Subject Re: AS s(a) vs. AS a
Date
Msg-id 7050.1350008301@sss.pgh.pa.us
Whole thread Raw
In response to AS s(a) vs. AS a  (Thalis Kalfigkopoulos <tkalfigo@gmail.com>)
List pgsql-general
Thalis Kalfigkopoulos <tkalfigo@gmail.com> writes:
> I see in the docs the following:
> SELECT current_date + s.a AS dates FROM generate_series(0,14,7) AS s(a);

> Trying it as:
> SELECT current_date + a AS dates FROM generate_series(0,14,7) AS a;

> yields exactly the same result.

> Does the finer granularity/expressiveness offer some extra
> functionality in some cases or is it a matter of style?

IIRC, it's important for functions returning composite types.  For a
function returning scalar, "AS a" is equivalent to "AS a(a)".

            regards, tom lane


pgsql-general by date:

Previous
From: Vishalakshi Navaneethakrishnan
Date:
Subject: Postgres DB Migration from 8.3 to 9.1
Next
From: Gavin Flower
Date:
Subject: Re: Postgres DB Migration from 8.3 to 9.1