pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedProblem with extract function ?
4+ messages / 3 participants
[nested] [flat]
* Problem with extract function ?
@ 2020-11-12 12:26 Esteban Zimanyi <ezimanyi@ulb.ac.be>
2020-11-12 12:48 ` Re: Problem with extract function ? Erik Rijkers <er@xs4all.nl>
2020-11-12 15:32 ` Re: Problem with extract function ? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 4+ messages in thread
From: Esteban Zimanyi @ 2020-11-12 12:26 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Problem with extract function ?
2020-11-12 12:26 Problem with extract function ? Esteban Zimanyi <ezimanyi@ulb.ac.be>
@ 2020-11-12 12:48 ` Erik Rijkers <er@xs4all.nl>
1 sibling, 0 replies; 4+ messages in thread
From: Erik Rijkers @ 2020-11-12 12:48 UTC (permalink / raw)
To: Esteban Zimanyi <ezimanyi@ulb.ac.be>; +Cc: pgsql-bugs
On 2020-11-12 13:26, Esteban Zimanyi wrote:
> PostgreSQL 13rc1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
Did you notice Postgres 13 is available?
I can't reproduce this (Debian with postgres 12 or 13)
Erik
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Problem with extract function ?
2020-11-12 12:26 Problem with extract function ? Esteban Zimanyi <ezimanyi@ulb.ac.be>
@ 2020-11-12 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-11-12 15:56 ` Re: Problem with extract function ? Esteban Zimanyi <ezimanyi@ulb.ac.be>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2020-11-12 15:32 UTC (permalink / raw)
To: Esteban Zimanyi <ezimanyi@ulb.ac.be>; +Cc: pgsql-bugs
Esteban Zimanyi <ezimanyi@ulb.ac.be> writes:
> 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
That works fine for me. However, I can reproduce the syntax error
if I misspell "as":
# select current_date as today , extract(week from
current_date) ss weeknbyear;
ERROR: syntax error at or near "weeknbyear"
LINE 2: current_date) ss weeknbyear;
^
This leads me to suspect that you have some weird invisible character
(non-break space, zero-width space, etc) adjacent to "as". Postgres
is not terribly forgiving of non-ASCII whitespace.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Problem with extract function ?
2020-11-12 12:26 Problem with extract function ? Esteban Zimanyi <ezimanyi@ulb.ac.be>
2020-11-12 15:32 ` Re: Problem with extract function ? Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-11-12 15:56 ` Esteban Zimanyi <ezimanyi@ulb.ac.be>
0 siblings, 0 replies; 4+ messages in thread
From: Esteban Zimanyi @ 2020-11-12 15:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Erik Rijkers <er@xs4all.nl>; +Cc: pgsql-bugs
Many thanks to both of you Tom and Eric for your prompt response.
I installed 13.1 and now the problem is solved. The consequence of this
exchange is that I can now test MobilityDB on the brand new version of
PostgreSQL :-)
Regards
On Thu, Nov 12, 2020 at 4:32 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Esteban Zimanyi <ezimanyi@ulb.ac.be> writes:
> > 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
>
> That works fine for me. However, I can reproduce the syntax error
> if I misspell "as":
>
> # select current_date as today , extract(week from
> current_date) ss weeknbyear;
> ERROR: syntax error at or near "weeknbyear"
> LINE 2: current_date) ss weeknbyear;
> ^
>
> This leads me to suspect that you have some weird invisible character
> (non-break space, zero-width space, etc) adjacent to "as". Postgres
> is not terribly forgiving of non-ASCII whitespace.
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-11-12 15:56 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 12:26 Problem with extract function ? Esteban Zimanyi <ezimanyi@ulb.ac.be>
2020-11-12 12:48 ` Erik Rijkers <er@xs4all.nl>
2020-11-12 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-11-12 15:56 ` Esteban Zimanyi <ezimanyi@ulb.ac.be>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox