Problem with extract function ?

From: Esteban Zimanyi <ezimanyi(at)ulb(dot)ac(dot)be>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Problem with extract function ?
Date: 2020-11-12 12:26:54
Message-ID: CAPqRbE6JOnxMNhuO4n=EQ31Y8kF15qKZ1vR6rmPviUsmgJZB3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Is there a problem with the extract function as shown below? In the SELECT
clause it should be possible to rename any column by adding after the
column "as xxx" or simply "xxx".

------------------------------------------------------
NorthwindDW=# select current_date today , extract(week from
current_date) weeknbyear;
today | weeknbyear
------------+-------------
2020-11-12 | 46
(1 row)

NorthwindDW=# select current_date as today , extract(week from
current_date) as weeknbyear;
2020-11-12 13:25:21.217 CET [20130] ERROR: syntax error at or near
"weeknbyear" at character 67
2020-11-12 13:25:21.217 CET [20130] STATEMENT: select current_date as
today , extract(week from current_date) as weeknbyear;
ERROR: syntax error at or near "weeknbyear"
LINE 1: ...ate as today , extract(week from current_date) as weeknbyear...
^
NorthwindDW=# select current_date as today , extract(week from
current_date) as xxx;
2020-11-12 13:25:37.817 CET [20130] ERROR: syntax error at or near "xxx"
at character 67
2020-11-12 13:25:37.817 CET [20130] STATEMENT: select current_date as
today , extract(week from current_date) as xxx;
ERROR: syntax error at or near "xxx"
LINE 1: ...rent_date as today , extract(week from current_date) as xxx;
^
NorthwindDW=# select version();
version
-------------------------------------------------------------------------------------------------
PostgreSQL 13rc1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
9.3.0-10ubuntu2) 9.3.0, 64-bit
(1 row)
------------------------------------------------------

Regards

Esteban

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Erik Rijkers 2020-11-12 12:48:24 Re: Problem with extract function ?
Previous Message Magnus Hagander 2020-11-12 10:18:30 Re: Problem with gdal