Re: AT detach partition is broken

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: AT detach partition is broken
Date: 2017-02-14 17:37:14
Message-ID: CA+TgmobddaT+GooogcVrzwrJ=EVmJZBbQUNTu+Y9EbEfPNH_xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 13, 2017 at 2:30 AM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> I noticed that running ALTER TABLE table_name DETACH PARTITION crashes, if
> table_name is not a partitioned table. That's because of an Assert in
> ATExecDetachPartition(). We really should error out much sooner in this
> case, IOW during transformAlterTableStmt(), as is done in the case of
> ATTACH PARTITION.
>
> Attached patch fixes that.

- /* assign transformed values */
- partcmd->bound = cxt.partbound;
+ /*
+ * Assign transformed value of the partition bound, if
+ * any.
+ */
+ if (cxt.partbound != NULL)
+ partcmd->bound = cxt.partbound;

This hunk isn't really needed, is it? I mean, if cxt.partbound comes
out NULL, then partcmd->bound will be NULL with or without adding an
"if" here, won't it?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2017-02-14 17:37:48 Re: removing tsearch2
Previous Message Robert Haas 2017-02-14 17:32:48 Re: [PROPOSAL] timestamp informations to pg_stat_statements