From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net> |
Subject: | OBJECT_ATTRIBUTE is useless (or: ALTER TYPE vs ALTER TABLE for composites) |
Date: | 2015-02-23 19:01:35 |
Message-ID: | 20150223190135.GB5169@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I found that the OBJECT_ATTRIBUTE symbol is useless. I can just remove
it and replace it with OBJECT_COLUMN, and everything continues to work;
no test fails that I can find.
I thought we had a prohibition against ALTER TABLE when used on
composites, but it's not as severe as I thought. The following commands
fail in master:
ALTER TABLE comptype RENAME TO comptype2; -- HINT: Use ALTER TYPE
ALTER TABLE comptype SET SCHEMA sch; -- HINT: Use ALTER TYPE
However, the following command works in master:
ALTER TABLE comptype RENAME COLUMN a TO b;
and has the same effect as this:
ALTER TYPE comptype RENAME ATTRIBUTE a TO b;
The RENAME ATTTRIBUTE case in RenameStmt is the only thing currently
using OBJECT_ATTRIBUTE; therefore, since in precisely that case we do
not prohibit using ALTER TABLE, we can just remove OBJECT_ATTRIBUTE
completely. That leads to the attached patch, which changes no test
result at all.
This symbol was added in
commit e440e12c562432a2a695b8054964fb34e3bd823e
Author: Peter Eisentraut <peter_e(at)gmx(dot)net>
Date: Sun Sep 26 14:41:03 2010 +0300
Add ALTER TYPE ... ADD/DROP/ALTER/RENAME ATTRIBUTE
Like with tables, this also requires allowing the existence of
composite types with zero attributes.
reviewed by KaiGai Kohei
Thoughts?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
remove-objattr.patch | text/x-diff | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2015-02-23 19:17:05 | Re: Abbreviated keys for text cost model fix |
Previous Message | Peter Geoghegan | 2015-02-23 18:22:32 | Re: Abbreviated keys for text cost model fix |