Re: ALTER command reworks

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER command reworks
Date: 2012-10-05 14:50:43
Message-ID: 20121005145042.GA5769@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kohei KaiGai escribió:
> 2012/8/31 Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>:
> > 2012/8/30 Robert Haas <robertmhaas(at)gmail(dot)com>:
> >> On Mon, Aug 13, 2012 at 3:35 PM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:

> >>> Was it a right decision to track dependency of large object using
> >>> oid of pg_largeobject, instead of pg_largeobject_metadata?
> >>> IIRC, the reason why we used oid of pg_largeobject is backward
> >>> compatibility for applications that tries to reference pg_depend
> >>> with built-in oids.
> >>
> >> I think it was a terrible decision and I'm pretty sure I said as much
> >> at the time, but I lost the argument, so I'm inclined to think we're
> >> stuck with continuing to support that kludge.
> >>
> > OK, we will keep to implement carefully...

After reviewing this patch, I think we need to revisit this decision.

> > OK, I'll split the patch into three (isn't it?) portions; RENAME, SET OWNER
> > and SET SCHEMA, with all above your suggestions.
> >
> As attached, I split off the original one into three portions; for set-schema,
> set-owner and rename-to. Please apply them in order of patch filename.
> Regarding to the error message, RenameErrorMsgAlreadyExists() was added
> to handle per object type messages in case when aclcheck_error() is not
> available to utilize.

Here's the remaining piece; the RENAME part. I have reworked it a bit,
but it needs a bit more work yet. Note this:

alvherre=# alter function foo.g(int, int) rename to g;
ERROR: function foo.g(integer,integer) already exists in schema "foo"

The previous code would have said

alvherre=# alter function foo.g(int, int) rename to g;
ERROR: function g(integer, integer) already exists in schema "foo"

Note that the function name is not qualified here. The difference is
that the original code was calling funcname_signature_string() to format
the function name, and the new code is calling format_procedure(). This
seems wrong to me; please rework.

I haven't checked other object renames, but I think they should be okay
because functions are the only objects for which we pass the OID instead
of the name to the error message function.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pgsql-v9.3-alter-reworks.3-rename.v4.patch text/x-diff 42.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-10-05 15:28:27 Re: Deparsing DDL command strings
Previous Message Tom Lane 2012-10-05 14:24:55 Re: Deparsing DDL command strings