pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #17765: SELECT CAST(true AS BIGINT);
3+ messages / 3 participants
[nested] [flat]
* BUG #17765: SELECT CAST(true AS BIGINT);
@ 2023-01-31 13:39 PG Bug reporting form <noreply@postgresql.org>
2023-01-31 14:48 ` Re: BUG #17765: SELECT CAST(true AS BIGINT); David G. Johnston <david.g.johnston@gmail.com>
2023-01-31 15:00 ` Re: BUG #17765: SELECT CAST(true AS BIGINT); Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: PG Bug reporting form @ 2023-01-31 13:39 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: vvinnikov@list.ru
The following bug has been logged on the website:
Bug reference: 17765
Logged by: Vladimir Vinnikov
Email address: vvinnikov@list.ru
PostgreSQL version: 15.1
Operating system: x86_64-pc-linux-gnu
Description:
ERROR: cannot cast type boolean to bigint
That's inconsistent since casting boolean to int is OK (SELECT CAST(true AS
INT);) or double casting is OK (SELECT CAST(CAST(true AS INT) AS BIGINT);).
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #17765: SELECT CAST(true AS BIGINT);
2023-01-31 13:39 BUG #17765: SELECT CAST(true AS BIGINT); PG Bug reporting form <noreply@postgresql.org>
@ 2023-01-31 14:48 ` David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2023-01-31 14:48 UTC (permalink / raw)
To: vvinnikov@list.ru <vvinnikov@list.ru>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
On Tuesday, January 31, 2023, PG Bug reporting form <noreply@postgresql.org>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17765
> Logged by: Vladimir Vinnikov
> Email address: vvinnikov@list.ru
> PostgreSQL version: 15.1
> Operating system: x86_64-pc-linux-gnu
> Description:
>
> ERROR: cannot cast type boolean to bigint
>
> That's inconsistent since casting boolean to int is OK (SELECT CAST(true AS
> INT);) or double casting is OK (SELECT CAST(CAST(true AS INT) AS BIGINT);).
>
>
If you want to create your own cast by all means, but just because we are
stuck with allowing bool-to-int doesn’t mean we have allow bool-to-bigint.
This is neither a big nor, IMO, a desirable feature. Casts that don’t make
sense should not exist. And I have no clue how the double-casting example
means anything here. Of course integer to bigint is a valid cast.
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #17765: SELECT CAST(true AS BIGINT);
2023-01-31 13:39 BUG #17765: SELECT CAST(true AS BIGINT); PG Bug reporting form <noreply@postgresql.org>
@ 2023-01-31 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2023-01-31 15:00 UTC (permalink / raw)
To: vvinnikov@list.ru; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> ERROR: cannot cast type boolean to bigint
> That's inconsistent since casting boolean to int is OK (SELECT CAST(true AS
> INT);) or double casting is OK (SELECT CAST(CAST(true AS INT) AS BIGINT);).
We also don't offer direct casts from bool to smallint, numeric, float4,
or float8. I'm disinclined to add any of those, although you certainly
can make them locally if you need them.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-01-31 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 13:39 BUG #17765: SELECT CAST(true AS BIGINT); PG Bug reporting form <noreply@postgresql.org>
2023-01-31 14:48 ` David G. Johnston <david.g.johnston@gmail.com>
2023-01-31 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
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