Re: [Proposal] Global temporary tables
曾文旌 (义从) <wenjing.zwj@alibaba-inc.com>
From: wjzeng <wenjing.zwj@alibaba-inc.com>
To: Prabhat Sahu <prabhat.sahu@enterprisedb.com>,
Pavel Stehule <pavel.stehule@gmail.com>
Cc: tushar <tushar.ahuja@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, Konstantin Knizhnik <k.knizhnik@postgrespro.ru>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, "蔡松露(子嘉)" <zijia@taobao.com>, "Cai, Le" <le.cai@alibaba-inc.com>, "萧少聪(铁庵)" <shaocong.xsc@alibaba-inc.com>
Date: 2020-03-26T03:15:08Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
PageAddItemExtended(): Add LP_UNUSED assertion.
- 30aaab26e521 14.0 cited
-
Remove temporary files after backend crash
- cd91de0d1795 14.0 cited
-
Fix comment in indexing.c
- 9fd2952cf492 14.0 cited
-
Fix failure to ignore leftover temp tables after a server crash.
- 6919b7e32947 9.3.0 cited
> 2020年3月25日 下午8:52,Prabhat Sahu <prabhat.sahu@enterprisedb.com> 写道:
>
> Hi All,
>
> Please check the behavior of GTT having column with "SERIAL" datatype and column with default value as "SEQUENCE" as below:
>
> Session1:
> postgres=# create sequence gtt_c3_seq;
> CREATE SEQUENCE
> postgres=# create global temporary table gtt(c1 int, c2 serial, c3 int default nextval('gtt_c3_seq') not null) on commit preserve rows;
> CREATE TABLE
>
> -- Structure of column c2 and c3 are similar:
> postgres=# \d+ gtt
> Table "public.gtt"
> Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
> --------+---------+-----------+----------+---------------------------------+---------+--------------+-------------
> c1 | integer | | | | plain | |
> c2 | integer | | not null | nextval('gtt_c2_seq'::regclass) | plain | |
> c3 | integer | | not null | nextval('gtt_c3_seq'::regclass) | plain | |
> Access method: heap
> Options: on_commit_delete_rows=false
>
> postgres=# insert into gtt select generate_series(1,3);
> INSERT 0 3
> postgres=# select * from gtt;
> c1 | c2 | c3
> ----+----+----
> 1 | 1 | 1
> 2 | 2 | 2
> 3 | 3 | 3
> (3 rows)
>
> Session2:
> postgres=# insert into gtt select generate_series(1,3);
> INSERT 0 3
> postgres=# select * from gtt;
> c1 | c2 | c3
> ----+----+----
> 1 | 1 | 4
> 2 | 2 | 5
> 3 | 3 | 6
> (3 rows)
>
> Kindly let me know, Is this behavior expected?
>
> --
postgres=# \d+
List of relations
Schema | Name | Type | Owner | Persistence | Size | Description
--------+------------+----------+-------------+-------------+------------+-------------
public | gtt | table | wenjing.zwj | session | 8192 bytes |
public | gtt_c2_seq | sequence | wenjing.zwj | session | 8192 bytes |
public | gtt_c3_seq | sequence | wenjing.zwj | permanent | 8192 bytes |
(3 rows)
This is expected.
GTT'sequence is the same as GTT, so gtt_c2_seq is independent of each sessions.
gtt_c3_seq is a classic sequence.
Wenjing
> With Regards,
> Prabhat Kumar Sahu
> EnterpriseDB: http://www.enterprisedb.com <http://www.enterprisedb.com/>