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

From Erik Wienhold
Subject Re: Question about accessing partitions whose name includes the schema name and a period - is this correct?
Date
Msg-id 1692955914.591234.1681953529723@office.mailbox.org
Whole thread Raw
In response to Re: Question about accessing partitions whose name includes the schema name and a period - is this correct?  (Jay Stanley <beansboy@cruzio.com>)
List pgsql-general
> On 20/04/2023 00:50 CEST Jay Stanley <beansboy@cruzio.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



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: What happened to the tip "It is good practice to create a role that has the CREATEDB and CREATEROLE privileges..."
Next
From: "jacktby@gmail.com"
Date:
Subject: How does pg index page optimize dead tuples?