Re: AS s(a) vs. AS a

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thalis Kalfigkopoulos <tkalfigo(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: AS s(a) vs. AS a
Date: 2012-10-12 02:18:21
Message-ID: 7050.1350008301@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thalis Kalfigkopoulos <tkalfigo(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2012-10-12 02:33:18 Re: Postgres DB Migration from 8.3 to 9.1
Previous Message Vishalakshi Navaneethakrishnan 2012-10-12 02:15:47 Postgres DB Migration from 8.3 to 9.1