Re: ALTER TYPE RENAME

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TYPE RENAME
Дата
Msg-id 4891.1191083788@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ALTER TYPE RENAME  (Petr Jelinek <pjmodos@pjmodos.net>)
Ответы Re: ALTER TYPE RENAME  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Petr Jelinek <pjmodos@pjmodos.net> writes:
> I noticed we don't have ALTER TYPE foo RENAME TO bar command which would
> be handy for me especially for enum types.
> So I wrote this little patch (including very brief doc) which adds above
> syntax. It basically just does some checks and calls existing TypeRename
> function which is used for renaming table rowtype now.
> I hope I haven't missed anything, but I am unsure about two things.
> First, this patch allows renaming base types which I don't know if it's
> desired. And second we might want to throw error when renaming rowtype
> (there is check in AlterTypeOwner for this but not in AlterTypeNamespace
> so I don't know).

Hm, it's definitely a bug/oversight that AlterTypeNamespace doesn't make
a similar test for that.  I think you should have to use ALTER TABLE to
muck with a table's rowtype.  Your patch as proposed would allow people
to get into a state where a table's rowtype is named differently than
the table, which is a horrid idea.  (For one thing, a dump/restore would
fail to preserve such a state.)

As for the patch at hand, I think it's very poor style to have functions
named both RenameType and TypeRename, with no obvious indication of
which does what.  The newly added function should be RenameType, since
that parallels the other callees of ExecRenameStmt, but I'd be inclined
to rename the existing function to RenameTypeInternal, as contemplated
in its header comment.  (BTW, your patch omits to fix its header
comment, which is rendered an outright lie by the patch.)

            regards, tom lane

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgcrypto: fix for broken solaris openssl, v03
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ALTER TYPE RENAME