pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance
@ 2017-01-09 22:27 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2017-01-09 22:27 UTC (permalink / raw)
  To: pgsql-committers

Fix ALTER TABLE / SET TYPE for irregular inheritance

If inherited tables don't have exactly the same schema, the USING clause
in an ALTER TABLE / SET DATA TYPE misbehaves when applied to the
children tables since commit 9550e8348b79.  Starting with that commit,
the attribute numbers in the USING expression are fixed during parse
analysis.  This can lead to bogus errors being reported during
execution, such as:
   ERROR:  attribute 2 has wrong type
   DETAIL:  Table has type smallint, but query expects integer.

Since it wouldn't do to revert to the original coding, we now apply a
transformation to map the attribute numbers to the correct ones for each
child.

Reported by Justin Pryzby
Analysis by Tom Lane; patch by me.
Discussion: https://postgr.es/m/20170102225618.GA10071@telsasoft.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3957b58b8885441c8d03bc1cfc00e47cf8cd7975

Modified Files
--------------
src/backend/access/common/tupconvert.c    | 110 ++++++++++++++++++------------
src/backend/commands/tablecmds.c          |  66 ++++++++++++++++--
src/include/access/tupconvert.h           |   4 ++
src/test/regress/expected/alter_table.out |  22 ++++++
src/test/regress/sql/alter_table.sql      |  22 ++++++
5 files changed, 175 insertions(+), 49 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance
@ 2017-01-09 22:27 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2017-01-09 22:27 UTC (permalink / raw)
  To: pgsql-committers

Fix ALTER TABLE / SET TYPE for irregular inheritance

If inherited tables don't have exactly the same schema, the USING clause
in an ALTER TABLE / SET DATA TYPE misbehaves when applied to the
children tables since commit 9550e8348b79.  Starting with that commit,
the attribute numbers in the USING expression are fixed during parse
analysis.  This can lead to bogus errors being reported during
execution, such as:
   ERROR:  attribute 2 has wrong type
   DETAIL:  Table has type smallint, but query expects integer.

Since it wouldn't do to revert to the original coding, we now apply a
transformation to map the attribute numbers to the correct ones for each
child.

Reported by Justin Pryzby
Analysis by Tom Lane; patch by me.
Discussion: https://postgr.es/m/20170102225618.GA10071@telsasoft.com

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4e563a1f6532decf7949324d313f264a4ed38622

Modified Files
--------------
src/backend/access/common/tupconvert.c    | 110 ++++++++++++++++++------------
src/backend/commands/tablecmds.c          |  66 ++++++++++++++++--
src/include/access/tupconvert.h           |   4 ++
src/test/regress/expected/alter_table.out |  22 ++++++
src/test/regress/sql/alter_table.sql      |  22 ++++++
5 files changed, 175 insertions(+), 49 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance
@ 2017-01-09 22:27 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2017-01-09 22:27 UTC (permalink / raw)
  To: pgsql-committers

Fix ALTER TABLE / SET TYPE for irregular inheritance

If inherited tables don't have exactly the same schema, the USING clause
in an ALTER TABLE / SET DATA TYPE misbehaves when applied to the
children tables since commit 9550e8348b79.  Starting with that commit,
the attribute numbers in the USING expression are fixed during parse
analysis.  This can lead to bogus errors being reported during
execution, such as:
   ERROR:  attribute 2 has wrong type
   DETAIL:  Table has type smallint, but query expects integer.

Since it wouldn't do to revert to the original coding, we now apply a
transformation to map the attribute numbers to the correct ones for each
child.

Reported by Justin Pryzby
Analysis by Tom Lane; patch by me.
Discussion: https://postgr.es/m/20170102225618.GA10071@telsasoft.com

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4d4ab6ccd8a24a91ef9fc1904f0e80a2fd0377fe

Modified Files
--------------
src/backend/access/common/tupconvert.c    | 110 ++++++++++++++++++------------
src/backend/commands/tablecmds.c          |  66 ++++++++++++++++--
src/include/access/tupconvert.h           |   4 ++
src/test/regress/expected/alter_table.out |  22 ++++++
src/test/regress/sql/alter_table.sql      |  22 ++++++
5 files changed, 175 insertions(+), 49 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-01-09 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 22:27 pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance Alvaro Herrera <alvherre@alvh.no-ip.org>
2017-01-09 22:27 pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance Alvaro Herrera <alvherre@alvh.no-ip.org>
2017-01-09 22:27 pgsql: Fix ALTER TABLE / SET TYPE for irregular inheritance Alvaro Herrera <alvherre@alvh.no-ip.org>

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