git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 7403561) | patch
Fix ALTER TABLE / SET TYPE for irregular inheritance
Mon, 9 Jan 2017 22:26:58 +0000 (19:26 -0300)
Mon, 9 Jan 2017 22:26:58 +0000 (19:26 -0300)
commit 3957b58b8885441c8d03bc1cfc00e47cf8cd7975
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
src/backend/access/common/tupconvert.c diff | blob | blame | history
src/backend/commands/tablecmds.c diff | blob | blame | history
src/include/access/tupconvert.h diff | blob | blame | history
src/test/regress/expected/alter_table.out diff | blob | blame | history
src/test/regress/sql/alter_table.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /