Re: Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement
Date
Msg-id CA+TgmoYj3a80+0s+E7PMieV55x4tpXU1JgVDz-1jr5tKz8JPjA@mail.gmail.com
Whole thread Raw
In response to Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement  (Kohei KaiGai <kaigai@kaigai.gr.jp>)
Responses Re: Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement
Re: Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement
List pgsql-hackers
On Tue, Nov 15, 2011 at 4:43 AM, Kohei KaiGai <kaigai@kaigai.gr.jp> wrote:
> Part-1) DROP statement refactoring
> It is a remaining portion of what I submitted in the last commit fest.
> It allows object types that didn't used DropStmt in gram.y to go
> through RemoveObjects(), instead of individual RemoveXXXX().

Review of just this part:

- I think we can remove the special case for foreign data wrappers
because (1) the only case in which there's any behavioral difference
at all is if a superuser creates a foreign data wrapper (or the
ownership of one is reassigned to him) and he is then made not a
superuser; non-superusers can't create foreign data wrappers, and
existing foreign data wrappers can't be given to non-superusers;
moreover, (2) removing the special case causes the behavior to match
the documentation, which it currently doesn't (but only in the
aforementioned, extremely minor way).

- On the other hand, this patch blithely nukes the prohibition on
using DROP FUNCTION to remove an aggregate.  I'm not sure that's a
good idea.  It also eliminates the NOTICE when removing a built-in
function, which I think is OK because you don't actually get that far:

rhaas=# drop function int4pl(integer, integer);
ERROR:  cannot drop function int4pl(integer,integer) because it is
required by the database system

- For some reason, we have code that causes procedural language names
to be downcased before use.  Given that unquoted identifiers are
downcased anyway, this seems a bit redundant.  I'm inclined to think
we don't need to preserve that behavior for DROP, especially because
other parts of the code - such as COMMENT - don't know about it
anyway.  But rather than just changing it for DROP, I think we should
go through and rip out case_translate_language_name() across the
board, probably as a a separate commit.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Configuration include directory
Next
From: Scott Mead
Date:
Subject: Re: IDLE in transaction introspection