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