Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
| От | Tom Lane |
|---|---|
| Тема | Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 |
| Дата | |
| Msg-id | 2501011.1628277029@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 ("David G. Johnston" <david.g.johnston@gmail.com>) |
| Ответы |
Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
|
| Список | pgsql-bugs |
"David G. Johnston" <david.g.johnston@gmail.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
В списке pgsql-bugs по дате отправления: