Re: [Proposal] Global temporary tables

From: 曾文旌 <wenjing(dot)zwj(at)alibaba-inc(dot)com>
To: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
Cc: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, 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>
Subject: Re: [Proposal] Global temporary tables
Date: 2020-05-07 11:12:24
Message-ID: 4774529C-B8EA-484A-B34A-1AB6C892B3A0@alibaba-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 2020年4月29日 下午7:46,tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> 写道:
>
> On 4/29/20 8:52 AM, 曾文旌 wrote:
>> Fixed the error message to make the expression more accurate. In v33.
>
> Thanks wenjing
>
> Please refer this scenario , where getting an error while performing cluster o/p
>
> 1)
>
> X terminal -
>
> postgres=# create global temp table f(n int);
> CREATE TABLE
>
> Y Terminal -
>
> postgres=# create index index12 on f(n);
> CREATE INDEX
> postgres=# \q
>
> X terminal -
>
> postgres=# reindex index index12;
> REINDEX
> postgres=# cluster f using index12;
> ERROR: cannot cluster on invalid index "index12"
> postgres=# drop index index12;
> DROP INDEX
>
> if this is an expected , could we try to make the error message more simpler, if possible.
>
> Another issue -
>
> X terminal -
>
> postgres=# create global temp table f11(n int);
> CREATE TABLE
> postgres=# create index ind1 on f11(n);
> CREATE INDEX
> postgres=# create index ind2 on f11(n);
> CREATE INDEX
> postgres=#
>
> Y terminal -
>
> postgres=# drop table f11;
> ERROR: cannot drop index ind2 or global temporary table f11
> HINT: Because the index is created on the global temporary table and other backend attached it.
> postgres=#
>
> it is only mentioning about ind2 index but what about ind1 and what if - they have lots of indexes ?
> i think - we should not mix index information while dropping the table and vice versa.
postgres=# drop index index12;
ERROR: cannot drop index index12 or global temporary table f
HINT: Because the index is created on the global temporary table and other backend attached it.

postgres=# drop table f;
ERROR: cannot drop index index12 or global temporary table f
HINT: Because the index is created on the global temporary table and other backend attached it.
postgres=#

Dropping an index on a GTT and dropping a GTT with an index can both trigger this message, so the message looks like this, and it feels like there's no better way to do it.

Wenjing

>
> --
> regards,tushar
> EnterpriseDB https://www.enterprisedb.com/
> The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2020-05-07 11:26:27 Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
Previous Message Amit Kapila 2020-05-07 10:40:17 Re: PG compilation error with Visual Studio 2015/2017/2019