CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 - Mailing list pgsql-bugs

From David G. Johnston
Subject CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
Date
Msg-id CAKFQuwbcqiOK_XbjkgRK9dTH9n-GmpJtgWUp=Jh+7kEOOVnoGQ@mail.gmail.com
Whole thread Raw
In response to Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thursday, August 5, 2021, Tom Lane <tgl@sss.pgh.pa.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:


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.

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17137: Bug with datatypes definition in CTE
Next
From: Tom Lane
Date:
Subject: Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3