CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
Date: 2021-08-06 18:58:45
Message-ID: CAKFQuwbcqiOK_XbjkgRK9dTH9n-GmpJtgWUp=Jh+7kEOOVnoGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thursday, August 5, 2021, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

>
> So maybe we should back-patch, but I still feel nervous about that.
> Anybody else have an opinion here?
>
> With one eye on the calendar, I'm thinking that if we do decide
> to back-patch we should wait a week, rather than shoving this in
> just before a release wrap. OTOH, if it's v14 only it'd be better
> to have it appear in beta3 rather than later. Maybe we should
> push to v14 now, and consider back-patch in a few months if there
> are not complaints about beta3?
>
>
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;

LINE 2: SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(4))
^
HINT: Cast the output of the non-recursive term to the correct type.

And the just posted Bug 17137:

https://www.postgresql.org/message-id/17137-3d3732d5a259612c%40postgresql.org

Are these related?

I would agree with doing this in v14 then back-patch with the next update.
But i don’t have a technical feel here.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-08-06 19:10:29 Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
Previous Message PG Bug reporting form 2021-08-06 18:12:28 BUG #17137: Bug with datatypes definition in CTE