Re: ALTER OBJECT any_name SET SCHEMA name

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, 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-04 15:16:17
Message-ID: m2wrotktku.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Not having read the patch, but ... the idea that was in the back of
> my mind was to have a generic AlterObjectNamespace function that
> would take parameters approximately like the following:
>
> OID of catalog containing object
> Column number of catalog's namespace column (Anum_xxx constant)
> OID of intended new namespace

Ah, the trick is to use the Anum_xxx, of course. I couldn't get rid of
thinking how to dynamically access by name... will have a try at that,
thanks for the idea.

> You could do a generic heap_open() on the catalog using the OID,
> and then use heap_modify_tuple to apply the namespace column update.

Thanks for pointing me to the right APIs: finding them is where the time
is mostly spent as far as I'm concerned.

> It might be nice to include the "object already exists" check here
> too, which could probably be done if in addition the column number
> of the name column were passed in. Permission checks too, if the
> owner column number were passed in. Etc.

Well it seems that depending on the object, sometime only superusers are
allowed to edit things, and sometime the owner too. Will add a boolean
superuser_only in the prototype.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-11-04 15:18:13 Re: ALTER OBJECT any_name SET SCHEMA name
Previous Message Robert Haas 2010-11-04 15:05:24 Re: ALTER OBJECT any_name SET SCHEMA name