Re: AS s(a) vs. AS a
Re: AS s(a) vs. AS a
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Thalis Kalfigkopoulos 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
AS s(a) vs. AS a
От:
Thalis Kalfigkopoulos <tkalfigo@gmail.com>
Дата:
Hi all. 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? regards, --Thalis