Re: wrong hint message for ALTER FOREIGN TABLE
От | Tom Lane |
---|---|
Тема | Re: wrong hint message for ALTER FOREIGN TABLE |
Дата | |
Msg-id | 23442.1303776154@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: wrong hint message for ALTER FOREIGN TABLE (Robert Haas <robertmhaas@gmail.com>) |
Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes: > On Mon, Apr 25, 2011 at 7:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> As per the other thread today, this advice would usually be correct, >> so I think that not offering any advice at all would be a step down from >> that. > Well, currently ALTER TABLE will work even if the argument is a view > or sequence, but I view that as a backwards-compatibility kludge we > should be looking to move away from, not something we want to further > bake in. However, I'm out of time to bikeshed on this issue, so fix > it however you like. Well, actually, having looked at the proposed patch in context I now agree with Shigeru-san's fix: /* * For compatibility with prior releases, we don't complain if ALTER TABLE * or ALTER INDEX is used to renamesome other type of relation. But * ALTER SEQUENCE/VIEW/FOREIGN TABLE are only to be used with relations of *that type. */ if (reltype == OBJECT_SEQUENCE && relkind != RELKIND_SEQUENCE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a sequence", RelationGetRelationName(targetrelation)))); if (reltype == OBJECT_VIEW && relkind != RELKIND_VIEW) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a view", RelationGetRelationName(targetrelation)))); if (reltype == OBJECT_FOREIGN_TABLE && relkind != RELKIND_FOREIGN_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a foreign table", RelationGetRelationName(targetrelation)), errhint("Use ALTER FOREIGN TABLE instead."))); /* * Don't allow ALTER TABLE on composite types. We want people to use ALTER * TYPE for that. */ if (relkind== RELKIND_COMPOSITE_TYPE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a composite type", RelationGetRelationName(targetrelation)), errhint("UseALTER TYPE instead."))); If we haven't felt a need for HINTs for the ALTER SEQUENCE or ALTER VIEW cases, it seems unlikely that we need one for ALTER FOREIGN TABLE. Probably whoever wrote this was analogizing to the ALTER TABLE/TYPE case after it, but that's not the same kind of situation, as evidenced by the fact that the primary error message is worded differently. regards, tom lane
В списке pgsql-hackers по дате отправления: