From: | Gilles Darold <gilles(at)darold(dot)net> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Daniel Torres <nobeeakon(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: date with month and year |
Date: | 2015-05-22 09:16:03 |
Message-ID: | 555EF3D3.9030408@darold.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 22/05/2015 06:09, Adrian Klaver wrote:
> On 05/21/2015 09:04 PM, Alvaro Herrera wrote:
>> Adrian Klaver wrote:
>>
>>> SELECT
>>> extract (
>>> YEAR
>>> FROM
>>> school_day ) AS YEAR,
>>
>>> Reformatting courtesy of pgFormatter(http://sqlformat.darold.net/).
>>
>> FWIW I think this indenting of FROM inside an extract() call is odd and
>> ugly --- probably just an accident resulting from dealing with the
>> regular FROM clause. It seems to me that the "YEAR FROM school_day"
>> part should be considered a single argument instead of breaking it in
>> multiple lines.
>
> Probably so, but the output is a lot cleaner then what I did in psql.
> The author of pgFormatter will be interested in your comments:
>
> https://github.com/darold/pgFormatter
>
Indentation of FROM clause inside some pg functions ( extract overlay
substring trim ) will be processed just as a comma (commit 402304b),
like follow:
SELECT
extract (
year
FROM
school_day ) AS year;
SELECT
substring (
firstname
FROM
1 FOR 10 ) AS sname;
SELECT
substr (
firstname,
1,
10 ) AS strpart
FROM
mytable;
Best regards,
--
Gilles
GPL tools at http://www.darold.net/
(squidclamav - sendmailanalyzer - ora2pg - modproxyhtml - pgCluu
squidguardmgr - sysusage - squidanalyzer - pgbadger - pgformatter)
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2015-05-22 09:37:25 | Re: Grouping By Similarity (using pg_trgm)? |
Previous Message | Karsten Hilbert | 2015-05-22 09:02:29 | Re: date with month and year |