Re: rename table between schema with one command

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alex <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: rename table between schema with one command
Date: 2019-07-25 06:22:58
Message-ID: CAKFQuwYrSGZkbEzJOvoROFjSg=Yh7HumJaLgZj-FvqZzQ3ewaQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, July 24, 2019, Alex <zhihui(dot)fan1213(at)gmail(dot)com> wrote:

> for example we have table t1 under schema s1. can I rename it to s2.t2
> with one command.
>
> currently I can do:
>
> alter table s1.t1 set schema s2;
> alter table s2.t1 rename to t2.
>

No. AFAIK alter table is the obly sql command that can do those things and
the syntax does not provide a way to combine the two into a single
executable command.

Out of curosity, why do you ask?

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Cyril Champier 2019-07-25 07:43:25 Re: Default ordering option
Previous Message Guyren Howe 2019-07-25 05:52:33 Re: Request for resolution || Support