Re: ALTER OBJECT any_name SET SCHEMA name

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER OBJECT any_name SET SCHEMA name
Date: 2010-11-04 14:27:45
Message-ID: 1288880696-sup-3910@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Dimitri Fontaine's message of jue nov 04 11:06:48 -0300 2010:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > FWIW I think you should use getObjectDescription, as in the attached
> > patch. (Note the patch is incomplete and does not compile because only
> > one caller to CheckSetNamespace has been fixed).
>
> I had to re-add the object name to the CheckSetNamespace prototype to
> handle this particular check:
>
> /* check for duplicate name (more friendly than unique-index failure) */
> if (SearchSysCacheExists2(TYPENAMENSP,
> CStringGetDatum(name),
> ObjectIdGetDatum(nspOid)))

Hmm, this check is wrong anyway, because you're looking in the pg_type
syscache for objects from an arbitrary catalog. That needs to be fixed
somehow, but perhaps it needs to be handled by the callers, not in this
routine. Otherwise you're going to need to pass the syscache ID, as
well as Datums identifying the object, and the number of Datums.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-11-04 14:37:37 Re: ALTER OBJECT any_name SET SCHEMA name
Previous Message Thom Brown 2010-11-04 14:12:23 Re: Alter column to type serial