Re: [Proposal] Global temporary tables

From: 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>
To: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Tomas Vondra" <tomas(dot)vondra(at)2ndquadrant(dot)com>, "Konstantin Knizhnik" <k(dot)knizhnik(at)postgrespro(dot)ru>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, 蔡松露(子嘉) <zijia(at)taobao(dot)com>, Cai, Le <le(dot)cai(at)alibaba-inc(dot)com>, 萧少聪(铁庵) <shaocong(dot)xsc(at)alibaba-inc(dot)com>
Subject: Re: [Proposal] Global temporary tables
Date: 2020-02-25 08:53:21
Message-ID: FACE0846-991E-402D-9C76-BEB51D7B9830@alibaba-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 2020年2月24日 下午9:41,Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> 写道:
>
>
>
> po 24. 2. 2020 v 14:34 odesílatel Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com <mailto:prabhat(dot)sahu(at)enterprisedb(dot)com>> napsal:
> Hi All,
>
> I observe a different behavior in "temporary table" and "global temporary table".
> Not sure if it is expected?
>
> postgres=# create global temporary table parent1(a int) on commit delete rows;
> CREATE TABLE
> postgres=# create global temporary table child1() inherits (parent1);
> CREATE TABLE
> postgres=# insert into parent1 values(1);
> INSERT 0 1
> postgres=# insert into child1 values(2);
> INSERT 0 1
> postgres=# select * from parent1;
> a
> ---
> (0 rows)
>
> postgres=# select * from child1;
> a
> ---
> (0 rows)
>
> It is bug. Probably INHERITS clause is not well implemented for GTT
I fixed the GTT's behavior, like local temp table.

Wenjing

>
>
>
>
> postgres=# create temporary table parent2(a int) on commit delete rows;
> CREATE TABLE
> postgres=# create temporary table child2() inherits (parent2);
> CREATE TABLE
> postgres=# insert into parent2 values(1);
> INSERT 0 1
> postgres=# insert into child2 values(2);
> INSERT 0 1
> postgres=# select * from parent2;
> a
> ---
> 2
> (1 row)
>
> postgres=# select * from child2;
> a
> ---
> 2
> (1 row)
>
>
> Thanks,
> Prabhat Sahu
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 曾文旌 (义从) 2020-02-25 08:55:46 Re: [Proposal] Global temporary tables
Previous Message Vladimir Sitnikov 2020-02-25 08:42:47 Re: Error on failed COMMIT