Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
От | Dean Rasheed |
---|---|
Тема | Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 |
Дата | |
Msg-id | CAEZATCWcOOGcYwTV0pv2F0o07w+dL7A2JN88fq5U-K29i=Ls=A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3 (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: CAST from numeric(18,3) to numeric doesnt work, posgresql 13.3
|
Список | pgsql-bugs |
On Thu, 5 Aug 2021 at 02:35, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Hmm, interesting. The cause of this is that coerce_type_typmod > supposes that casting to a -1 typmod is a total no-op. Which > is true so far as the run-time behavior is concerned, but not > if something inspects the exposed type of the expression. > > The attached seems to be enough to fix it, though I wonder if > we've made the same assumption anywhere else. +1 for fixing this. > Although this changes no existing regression test results, > I'm still a bit hesitant to back-patch it, because I am not > real sure that nothing out there is depending on the current > behavior (which has stood for decades). I think it'd be all > right to put into HEAD, and maybe it's not too late for v14. This isn't the first time someone has hit this [1]. The failing CTE query there is quite interesting because if ::varchar[] with no typmod wasn't a no-op, it could have been used to fix it. In fact, that's what the error message and hint suggest doing. So this fix is potentially more widely useful, though I couldn't say whether anyone is relying on the current behaviour. Regards, Dean [1] https://dba.stackexchange.com/questions/116218/surprising-results-for-data-types-with-type-modifier
В списке pgsql-bugs по дате отправления: