pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Don't elide casting to typmod -1. 7+ messages / 1 participants [nested] [flat]
* pgsql: Don't elide casting to typmod -1. @ 2021-08-06 21:33 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-08-06 21:33 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. (I strongly suspect that it's like this in part because the logic pre-dates the introduction of RelabelType in 7.0. The commit log message for 57b30e8e2 is interesting reading here.) As a compromise, we'll sneak the change into 14beta3, and consider back-patching to stable branches if no complaints emerge in the next three months. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/5c056b0c2519e602c2e98bace5b16d2ecde6454b Modified Files -------------- src/backend/parser/parse_coerce.c | 26 ++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 21 ++++++++++++++++++ 3 files changed, 75 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-08-06 21:33 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-08-06 21:33 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. (I strongly suspect that it's like this in part because the logic pre-dates the introduction of RelabelType in 7.0. The commit log message for 57b30e8e2 is interesting reading here.) As a compromise, we'll sneak the change into 14beta3, and consider back-patching to stable branches if no complaints emerge in the next three months. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e5f6493e3584ea7eec1f992f87639e7f186ae03e Modified Files -------------- src/backend/parser/parse_coerce.c | 26 ++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 21 ++++++++++++++++++ 3 files changed, 75 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-09-20 15:49 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-09-20 15:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. But no complaints have emerged about 14beta3, so go ahead and back-patch. Back-patch of 5c056b0c2 into previous supported branches. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Discussion: https://postgr.es/m/1488389.1631984807@sss.pgh.pa.us Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/dede1439978120d2196e0d3963bb809a8b262e5b Modified Files -------------- src/backend/parser/parse_coerce.c | 26 ++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 20 +++++++++++++++++ 3 files changed, 74 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-09-20 15:49 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-09-20 15:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. But no complaints have emerged about 14beta3, so go ahead and back-patch. Back-patch of 5c056b0c2 into previous supported branches. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Discussion: https://postgr.es/m/1488389.1631984807@sss.pgh.pa.us Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f230614da28b1b60a4c8faf1fe0f51f866c3093c Modified Files -------------- src/backend/parser/parse_coerce.c | 26 ++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 20 +++++++++++++++++ 3 files changed, 74 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-09-20 15:49 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-09-20 15:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. But no complaints have emerged about 14beta3, so go ahead and back-patch. Back-patch of 5c056b0c2 into previous supported branches. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Discussion: https://postgr.es/m/1488389.1631984807@sss.pgh.pa.us Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/914e54501bccc1bca35984c64dd6a15c1b20e492 Modified Files -------------- src/backend/parser/parse_coerce.c | 30 +++++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 20 +++++++++++++++++ 3 files changed, 78 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-09-20 15:49 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-09-20 15:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. But no complaints have emerged about 14beta3, so go ahead and back-patch. Back-patch of 5c056b0c2 into previous supported branches. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Discussion: https://postgr.es/m/1488389.1631984807@sss.pgh.pa.us Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/923b7efc259818688979f38ba88cba0d0d41ba10 Modified Files -------------- src/backend/parser/parse_coerce.c | 30 +++++++++++++++++-------- src/test/regress/expected/expressions.out | 37 +++++++++++++++++++++++++++++++ src/test/regress/sql/expressions.sql | 20 +++++++++++++++++ 3 files changed, 78 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Don't elide casting to typmod -1. @ 2021-09-20 15:49 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-09-20 15:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't elide casting to typmod -1. Casting a value that's already of a type with a specific typmod to an unspecified typmod doesn't do anything so far as run-time behavior is concerned. However, it really ought to change the exposed type of the expression to match. Up to now, coerce_type_typmod hasn't bothered with that, which creates gotchas in contexts such as recursive unions. If for example one side of the union is numeric(18,3), but it needs to be plain numeric to match the other side, there's no direct way to express that. This is easy enough to fix, by inserting a RelabelType to update the exposed type of the expression. However, it's a bit nervous-making to change this behavior, because it's stood for a really long time. But no complaints have emerged about 14beta3, so go ahead and back-patch. Back-patch of 5c056b0c2 into previous supported branches. Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com Discussion: https://postgr.es/m/1488389.1631984807@sss.pgh.pa.us Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/183b3acedab90390d07036bfd532481acd71cd1d Modified Files -------------- src/backend/parser/parse_coerce.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2021-09-20 15:49 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-08-06 21:33 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-08-06 21:33 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-09-20 15:49 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-09-20 15:49 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-09-20 15:49 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-09-20 15:49 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us> 2021-09-20 15:49 pgsql: Don't elide casting to typmod -1. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox