Move table - New schema

Lists: pgsql-general
From: António Rodrigues <n(dot)marxco(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Move table - New schema
Date: 2012-09-18 10:48:43
Message-ID: CABOU0iR=LmA34J=7Zzy2_toGdP+1aDpN0M9gveuB3xWW8SzXkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi list,

(newbie question)

I'm trying to move a set of tables between schemas.

Tried:

ALTER TABLE tablename
SET SCHEMA schemaname

It gives me error: "schema schemaname does not exist" (it does)

Any help please.
Thanks,
António


From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: António Rodrigues <n(dot)marxco(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Move table - New schema
Date: 2012-09-18 13:37:39
Message-ID: 50587923.9000406@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 09/18/2012 03:48 AM, António Rodrigues wrote:
> Hi list,
>
> (newbie question)
>
> I'm trying to move a set of tables between schemas.
>
> Tried:
>
> ALTER TABLE tablename
> SET SCHEMA schemaname
>
> It gives me error: "schema schemaname does not exist" (it does)

http://www.postgresql.org/docs/9.0/interactive/sql-altertable.html

"You must own the table to use ALTER TABLE. To change the schema of a
table, you must also have CREATE privilege on the new schema"

Are you doing the above as the owner of the table and does the owner
have CREATE privileges on the new schema?

>
> Any help please.
> Thanks,
> António

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com


From: António Rodrigues <n(dot)marxco(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Move table - New schema
Date: 2012-09-18 14:06:34
Message-ID: CABOU0iSxwc9WJAQRqP8o0n2qbbLLp9ynz4h=85XLxv4hMU_gaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

You were both right. It was a problem with permissions.
Thank you,
António

On Tue, Sep 18, 2012 at 2:37 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>wrote:

> On 09/18/2012 03:48 AM, António Rodrigues wrote:
>
>> Hi list,
>>
>> (newbie question)
>>
>> I'm trying to move a set of tables between schemas.
>>
>> Tried:
>>
>> ALTER TABLE tablename
>> SET SCHEMA schemaname
>>
>> It gives me error: "schema schemaname does not exist" (it does)
>>
>
> http://www.postgresql.org/**docs/9.0/interactive/sql-**altertable.html<http://www.postgresql.org/docs/9.0/interactive/sql-altertable.html>
>
> "You must own the table to use ALTER TABLE. To change the schema of a
> table, you must also have CREATE privilege on the new schema"
>
> Are you doing the above as the owner of the table and does the owner have
> CREATE privileges on the new schema?
>
>
>
>> Any help please.
>> Thanks,
>> António
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>