From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: AT detach partition is broken |
Date: | 2017-02-16 00:45:53 |
Message-ID: | ea4de4ec-d881-33c6-5ebd-be7370b3e01d@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2017/02/15 2:37, Robert Haas wrote:
> 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?
You're right. Took this one out (except slightly tweaking the comment) in
the attached updated patch.
Thanks,
Amit
Attachment | Content-Type | Size |
---|---|---|
0001-Unbreak-ALTER-TABLE-DETACH-PARTITION.patch | text/x-diff | 4.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Haribabu Kommi | 2017-02-16 00:49:21 | Re: CREATE TABLE with parallel workers, 10.0? |
Previous Message | Tom Lane | 2017-02-15 23:51:03 | Re: bytea_output vs make installcheck |