RENAME RULE doesn't work with partitioned tables

Started by Amit Langoteabout 9 years ago3 messageshackers
Jump to latest
#1Amit Langote
Langote_Amit_f8@lab.ntt.co.jp

Just noticed that RangeVarCallbackForRenameRule() was not updated to
handle partitioned tables, causing the following bug:

create table parted_table (a int) partition by list (a);
create table part partition of parted_table for values in (1);
create rule parted_table_insert as on insert to parted_table
do instead insert into part values (new.*);
alter rule parted_table_insert on parted_table
rename to parted_table_insert_redirect;
-- ERROR: "parted_table" is not a table or view

Attached fixes this and adds a test. Added to open items list.

Thanks,
Amit

Attachments:

0001-Fix-RENAME-RULE-to-consider-partitioned-tables.patchtext/x-diff; name=0001-Fix-RENAME-RULE-to-consider-partitioned-tables.patchDownload+18-2
#2Robert Haas
robertmhaas@gmail.com
In reply to: Amit Langote (#1)
Re: RENAME RULE doesn't work with partitioned tables

On Tue, Apr 11, 2017 at 5:54 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:

Just noticed that RangeVarCallbackForRenameRule() was not updated to
handle partitioned tables, causing the following bug:

create table parted_table (a int) partition by list (a);
create table part partition of parted_table for values in (1);
create rule parted_table_insert as on insert to parted_table
do instead insert into part values (new.*);
alter rule parted_table_insert on parted_table
rename to parted_table_insert_redirect;
-- ERROR: "parted_table" is not a table or view

Attached fixes this and adds a test. Added to open items list.

Committed.

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Amit Langote
Langote_Amit_f8@lab.ntt.co.jp
In reply to: Robert Haas (#2)
Re: RENAME RULE doesn't work with partitioned tables

On 2017/04/12 2:20, Robert Haas wrote:

On Tue, Apr 11, 2017 at 5:54 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:

Just noticed that RangeVarCallbackForRenameRule() was not updated to
handle partitioned tables, causing the following bug:

create table parted_table (a int) partition by list (a);
create table part partition of parted_table for values in (1);
create rule parted_table_insert as on insert to parted_table
do instead insert into part values (new.*);
alter rule parted_table_insert on parted_table
rename to parted_table_insert_redirect;
-- ERROR: "parted_table" is not a table or view

Attached fixes this and adds a test. Added to open items list.

Committed.

Thanks.

Regards,
Amit

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers