From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Ján Pecsők <jan(dot)pecsok(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 |
Date: | 2021-08-06 19:10:29 |
Message-ID: | 2501011.1628277029@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> Here is a recent newbie help request I fielded in Discord:
> WITH RECURSIVE fizz_buzz (sequence, modulo_3, modulo_5) AS (
> SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(4))
> UNION ALL
> SELECT sequence + 1,
> CASE WHEN MOD(sequence + 1, 3) = 0 THEN 'Fizz'
> ELSE '' END,
> CASE WHEN MOD(sequence + 1, 5) = 0 THEN 'Buzz'
> ELSE '' END
> FROM fizz_buzz
> WHERE sequence < 100
> )
> SELECT
> CASE WHEN CONCAT(modulo_3, modulo_5) = '' THEN sequence
> ELSE CONCAT(modulo_3, modulo_5) END AS fizzbuzz
> FROM fizz_buzz;
I'd class that one as pilot error, in that the query author
isn't even trying to make the two sides of the union agree
type-wise. It's not the same as the point at hand, where
someone did try to cast to the correct type but the parser
ignored it.
> And the just posted Bug 17137:
> https://www.postgresql.org/message-id/17137-3d3732d5a259612c%40postgresql.org
> Are these related?
Right, that one is a dup of the current issue.
> I would agree with doing this in v14 then back-patch with the next update.
Yeah, I'm going to push to v14 shortly if I don't hear objections soon.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Julien Rouhaud | 2021-08-07 06:37:55 | Re: BUG #17136: set shared_preload_libraries = 'pg_stat_statements,pg_prewarm,pg_trgm' , postgresql Cannot Startup |
Previous Message | David G. Johnston | 2021-08-06 18:58:45 | CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 |