pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14935: Cast function shortcut gives an error
3+ messages / 3 participants
[nested] [flat]
* BUG #14935: Cast function shortcut gives an error
@ 2017-11-29 08:27 jzelez@gmail.com
0 siblings, 1 reply; 3+ messages in thread
From: jzelez@gmail.com @ 2017-11-29 08:27 UTC (permalink / raw)
To: pgsql-bugs; +Cc: jzelez@gmail.com
The following bug has been logged on the website:
Bug reference: 14935
Logged by: Jurica Železnjak
Email address: jzelez@gmail.com
PostgreSQL version: 10.1
Operating system: OS X
Description:
In some cases when using the shortcut notation "::" the database gives an
error.
GOOD:
CAST("sensors_sensordata"."data" #>> '{Temperature}' AS DOUBLE PRECISION) AS
"temp"
ERROR:
"sensors_sensordata"."data" #>> '{Temperature}'::DOUBLE PRECISION AS
"temp"
ERROR message:
[22P02] ERROR: invalid input syntax for type double precision:
"{Temperature}"
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14935: Cast function shortcut gives an error
@ 2017-11-29 09:52 Marko Tiikkaja <marko@joh.to>
parent: jzelez@gmail.com
0 siblings, 1 reply; 3+ messages in thread
From: Marko Tiikkaja @ 2017-11-29 09:52 UTC (permalink / raw)
To: jzelez@gmail.com; +Cc: pgsql-bugs
On Wed, Nov 29, 2017 at 10:27 AM, <jzelez@gmail.com> wrote:
> In some cases when using the shortcut notation "::" the database gives an
> error.
>
> GOOD:
> CAST("sensors_sensordata"."data" #>> '{Temperature}' AS DOUBLE PRECISION)
> AS
> "temp"
>
> ERROR:
> "sensors_sensordata"."data" #>> '{Temperature}'::DOUBLE PRECISION AS
> "temp"
>
The precedence between the two is different. The equivalent would be:
("sensors_sensordata"."data" #>> '{Temperature}')::DOUBLE PRECISION
In other words, not a bug.
.m
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14935: Cast function shortcut gives an error
@ 2017-11-29 10:03 Jurica Železnjak <jzelez@gmail.com>
parent: Marko Tiikkaja <marko@joh.to>
0 siblings, 0 replies; 3+ messages in thread
From: Jurica Železnjak @ 2017-11-29 10:03 UTC (permalink / raw)
To: Marko Tiikkaja <marko@joh.to>; +Cc: pgsql-bugs
Ok. Thanks... I guess I should bring attention to this to the Django team where they use it without the parenthesis.
Jurica
> On Wednesday, Nov 29, 2017 at 10:52 AM, Marko Tiikkaja <marko@joh.to (mailto:marko@joh.to)> wrote:
> On Wed, Nov 29, 2017 at 10:27 AM, <jzelez@gmail.com (mailto:jzelez@gmail.com)> wrote:
> > In some cases when using the shortcut notation "::" the database gives an
> > error.
> >
> > GOOD:
> > CAST("sensors_sensordata"."data" #>> '{Temperature}' AS DOUBLE PRECISION) AS
> > "temp"
> >
> > ERROR:
> > "sensors_sensordata"."data" #>> '{Temperature}'::DOUBLE PRECISION AS
> > "temp"
>
> The precedence between the two is different. The equivalent would be:
>
> ("sensors_sensordata"."data" #>> '{Temperature}')::DOUBLE PRECISION
>
> In other words, not a bug.
>
>
> .m
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-11-29 10:03 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 08:27 BUG #14935: Cast function shortcut gives an error jzelez@gmail.com
2017-11-29 09:52 ` Marko Tiikkaja <marko@joh.to>
2017-11-29 10:03 ` Jurica Železnjak <jzelez@gmail.com>
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