Re: ALTER OBJECT any_name SET SCHEMA name

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER OBJECT any_name SET SCHEMA name
Date: 2010-11-21 12:53:57
Message-ID: AANLkTimjOZpa0F7PMPWURNi68B7he8zYD2472aBXmAwr@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 20, 2010 at 11:23 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Ah, nuts.  I see now there's a v7.  Never mind...

OK. I looked at the right version, now. Hopefully.

It seems we have no regression tests at all for any of the existing
SET SCHEMA commands. This seems like a good time to correct that
oversight, and also add some for the new commands you're adding here.
(It might be helpful to submit the regression tests for the existing
commands as a separate patch.) Also, you're missing psql tab
completion support, which would be nice to have.

In CheckSetNamespace() you have the message 'already exists in schema'
there where the existing, similar checks say 'is already in schema',
which is a bit confusing. But that code looks useful, and in fact I
think we should use it for the existing object types also to avoid
code duplication. This is technically a regression in terms of
translatability, since instead of a single string that says something
like 'function %s is already in schema %s', you'll have '%s is already
in schema %s', and where the first %s is provided by
getObjectDescription(). But that doesn't seem like a problem, because
(1) we're already doing it that way for dependency error messages
anyway and (2) as far as I can tell from a visual scan and some
hacking with Google Translate, all of the languages for which we have
backend translations put the object type next to the object name
anyway.

So, attached is a proposed patch that just adds CheckSetNamespace()
and makes the existing SET SCHEMA commands use it. Barring
objections, I'll go ahead and commit this part.

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

Attachment Content-Type Size
check_set_namespace.patch application/octet-stream 7.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-11-21 13:11:18 Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Previous Message Robert Haas 2010-11-21 11:12:24 Re: Fwd: patch: format function - fixed oid