Re: Adding tests for inheritance trees with temporary tables

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding tests for inheritance trees with temporary tables
Date: 2018-06-19 07:34:43
Message-ID: CAFjFpRdoKgqW-VHNWV1SrwaOSzji1=KKQM3mwEso+M8xMsPYtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks. Some review comments here.

+create table inh_perm_parent (a1 int);
+create temp table inh_temp_parent (a1 int);
+create temp table inh_temp_child (a1 int) inherits (inh_perm_parent); -- ok
+NOTICE: merging column "a1" with inherited definition

You could actually avoid this notice by changing create table statement like
create temp table inh_temp_child () inherits (inh_perm_parent);

+create table inh_perm_child (a1 int) inherits (inh_temp_parent); -- error
+ERROR: cannot inherit from temporary relation "inh_temp_parent"
+create temp table inh_temp_child_2 (a1 int) inherits (inh_temp_parent); -- ok
+NOTICE: merging column "a1" with inherited definition

Same suggestion as above.

+insert into inh_perm_parent values (1);
+insert into inh_temp_parent values (2);
+insert into inh_temp_child values (3);
+insert into inh_temp_child_2 values (4);
+select * from inh_perm_parent;
+ a1
+----
+ 1
+ 3
+(2 rows)
+
+select * from inh_temp_parent;
+ a1
+----
+ 2
+ 4
+(2 rows)

select tabloid::regclass will also print the name of the table where
the row resides. That will be useful to check where the rows come from
and also to test the inheritance children.

On Tue, Jun 19, 2018 at 7:51 AM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Hi all,
>
> While look at the handling of temporary relations with partition trees,
> I have noticed that there are no tests for inheritance trees with temp
> tables. This has been mentioned here:
> https://www.postgresql.org/message-id/20180618060200.GG3721@paquier.xyz
>
> Attached is a patch to close the gap. That's of course not v11
> material, so I am parking this patch into the next CF.
>
> Thanks,
> --
> Michael

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2018-06-19 07:36:24 Re: Concurrency bug in UPDATE of partition-key
Previous Message Amit Langote 2018-06-19 07:27:08 Re: Partitioning with temp tables is broken