pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17762: date field casts to null in case section with join's
2+ messages / 2 participants
[nested] [flat]

* BUG #17762: date field casts to null in case section with join's
@ 2023-01-27 12:21 PG Bug reporting form <noreply@postgresql.org>
  2023-01-27 14:41 ` Re: BUG #17762: date field casts to null in case section with join's David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2023-01-27 12:21 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jounts@gmail.com

The following bug has been logged on the website:

Bug reference:      17762
Logged by:          Evgeny Nee
Email address:      jounts@gmail.com
PostgreSQL version: 15.1
Operating system:   debian 11
Description:        

Query works fine:
SELECT id, 
CASE
    WHEN date_field IS NOT NULL THEN date_field::TEXT
END AS date_str
FROM my_table

But this query:
SELECT t1id, t2.name, 
CASE
    WHEN t1.date_field IS NOT NULL THEN t1.date_field::TEXT
END AS date_str
FROM my_table t1
JOIN my_table2 t2 ON t1.id = t2.id

returns: null in date_str



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #17762: date field casts to null in case section with join's
  2023-01-27 12:21 BUG #17762: date field casts to null in case section with join's PG Bug reporting form <noreply@postgresql.org>
@ 2023-01-27 14:41 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2023-01-27 14:41 UTC (permalink / raw)
  To: jounts@gmail.com <jounts@gmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

On Friday, January 27, 2023, PG Bug reporting form <noreply@postgresql.org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference:      17762
> Logged by:          Evgeny Nee
> Email address:      jounts@gmail.com
> PostgreSQL version: 15.1
> Operating system:   debian 11
> Description:
>
> Query works fine:
> SELECT id,
> CASE
>     WHEN date_field IS NOT NULL THEN date_field::TEXT
> END AS date_str
> FROM my_table
>
> But this query:
> SELECT t1id, t2.name,
> CASE
>     WHEN t1.date_field IS NOT NULL THEN t1.date_field::TEXT
> END AS date_str
> FROM my_table t1
> JOIN my_table2 t2 ON t1.id = t2.id
>
> returns: null in date_str
>
>
A self-contained test case would be useful.  Something that executes using
psql ideally.

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-01-27 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 12:21 BUG #17762: date field casts to null in case section with join's PG Bug reporting form <noreply@postgresql.org>
2023-01-27 14:41 ` David G. Johnston <david.g.johnston@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