Re: Question about accessing partitions whose name includes the schema name and a period - is this correct?

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Jay Stanley <beansboy(at)cruzio(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Question about accessing partitions whose name includes the schema name and a period - is this correct?
Date: 2023-04-20 01:18:49
Message-ID: 1692955914.591234.1681953529723@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 20/04/2023 00:50 CEST Jay Stanley <beansboy(at)cruzio(dot)com> wrote:
>
> postgres=# alter table my_schema.my_table drop partition "my_schema"."my_schema.my_table_should_not_work";
> ERROR: syntax error at or near ""my_schema""
> LINE 1: alter table my_schema.my_table drop partition "my_schema"."m...
> ^
> -or-
> postgres=# alter table my_schema.my_table drop partition my_schema."my_schema.my_table_should_not_work";
> ERROR: syntax error at or near "my_schema"
> LINE 1: alter table my_schema.my_table drop partition my_schema."my_...

The command you're looking for is ALTER TABLE DETACH PARTITION.

DROP PARTITION means dropping the column named "partition". The syntax error
comes from the parser expecting an optional CASCADE or RESTRICT after DROP PARTITION.

--
Erik

In response to

Browse pgsql-general by date

  From Date Subject
Next Message jacktby@gmail.com 2023-04-20 01:41:52 How does pg index page optimize dead tuples?
Previous Message Adrian Klaver 2023-04-20 00:09:45 Re: What happened to the tip "It is good practice to create a role that has the CREATEDB and CREATEROLE privileges..."