pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Detaching multiple partitions in 1 ALTER TABLE statement
3+ messages / 3 participants
[nested] [flat]

* Detaching multiple partitions in 1 ALTER TABLE statement
@ 2019-06-20 14:19 Ben Hood <ben@relops.com>
  2019-06-20 16:00 ` Re: Detaching multiple partitions in 1 ALTER TABLE statement Simon Riggs <simon@2ndquadrant.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Ben Hood @ 2019-06-20 14:19 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi,

I’m wondering what is the syntax for detaching multiple partitions in 1 ALTER TABLE statement.

I’ve tried this:


# ALTER TABLE movement_legs DETACH PARTITION movement_legs_2019_06_20_11_15, DETACH PARTITION movement_legs_2019_06_20_11_20;
psql: ERROR:  syntax error at or near ","
LINE 1: ...gs DETACH PARTITION movement_legs_2019_06_20_11_15, DETACH P…


The documentation suggests "DETACH PARTITION can be combined into a list of multiple alterations to be applied together”:

https://www.postgresql.org/docs/12/sql-altertable.html

But I haven’t found an example of where multiple partitions are detached in 1 statement.

This is using version 12 beta 1.

Many thanks,

Ben






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Detaching multiple partitions in 1 ALTER TABLE statement
  2019-06-20 14:19 Detaching multiple partitions in 1 ALTER TABLE statement Ben Hood <ben@relops.com>
@ 2019-06-20 16:00 ` Simon Riggs <simon@2ndquadrant.com>
  2019-06-20 17:09   ` Re: Detaching multiple partitions in 1 ALTER TABLE statement Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Simon Riggs @ 2019-06-20 16:00 UTC (permalink / raw)
  To: Ben Hood <ben@relops.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Thu, 20 Jun 2019 at 15:19, Ben Hood <ben@relops.com> wrote:

> Hi,
>
> I’m wondering what is the syntax for detaching multiple partitions in 1
> ALTER TABLE statement.
>
> I’ve tried this:
>
>
> # ALTER TABLE movement_legs DETACH PARTITION
> movement_legs_2019_06_20_11_15, DETACH PARTITION
> movement_legs_2019_06_20_11_20;
> psql: ERROR:  syntax error at or near ","
> LINE 1: ...gs DETACH PARTITION movement_legs_2019_06_20_11_15, DETACH P…
>
>
> The documentation suggests "DETACH PARTITION can be combined into a list
> of multiple alterations to be applied together”:
>

Docs say this" All the forms of ALTER TABLE that act on a single table,
except RENAME , SET SCHEMA , ATTACH
PARTITION , and DETACH PARTITION  can be combined into a list of multiple
alterations to be
applied together."

Perhaps a comma would be helpful, but its clear that you can do multiple
detaches in one command at present.

But it sounds like a great feature.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Solutions for the Enterprise

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Detaching multiple partitions in 1 ALTER TABLE statement
  2019-06-20 14:19 Detaching multiple partitions in 1 ALTER TABLE statement Ben Hood <ben@relops.com>
  2019-06-20 16:00 ` Re: Detaching multiple partitions in 1 ALTER TABLE statement Simon Riggs <simon@2ndquadrant.com>
@ 2019-06-20 17:09   ` Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2019-06-20 17:09 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; Ben Hood <ben@relops.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On 6/20/19 9:00 AM, Simon Riggs wrote:
> On Thu, 20 Jun 2019 at 15:19, Ben Hood <ben@relops.com 
> <mailto:ben@relops.com>> wrote:
> 
>     Hi,
> 
>     I’m wondering what is the syntax for detaching multiple partitions
>     in 1 ALTER TABLE statement.
> 
>     I’ve tried this:
> 
> 
>     # ALTER TABLE movement_legs DETACH PARTITION
>     movement_legs_2019_06_20_11_15, DETACH PARTITION
>     movement_legs_2019_06_20_11_20;
>     psql: ERROR:  syntax error at or near ","
>     LINE 1: ...gs DETACH PARTITION movement_legs_2019_06_20_11_15, DETACH P…
> 
> 
>     The documentation suggests "DETACH PARTITION can be combined into a
>     list of multiple alterations to be applied together”:
> 
> 
> Docs say this" All the forms of ALTER TABLE that act on a single table, 
> except RENAME , SET SCHEMA , ATTACH
> PARTITION , and DETACH PARTITION  can be combined into a list of 
> multiple alterations to be
> applied together."
> 

> Perhaps a comma would be helpful, but its clear that you can do multiple 
                                                               ^not
Or I am thoroughly confused:)

> detaches in one command at present.
> 
> But it sounds like a great feature.
> 
> -- 
> Simon Riggshttp://www.2ndQuadrant.com/ <http://www.2ndquadrant.com/;
> PostgreSQL Solutions for the Enterprise


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-06-20 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 14:19 Detaching multiple partitions in 1 ALTER TABLE statement Ben Hood <ben@relops.com>
2019-06-20 16:00 ` Simon Riggs <simon@2ndquadrant.com>
2019-06-20 17:09   ` Adrian Klaver <adrian.klaver@aklaver.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox