Re: [Proposal] Global temporary tables - Mailing list pgsql-hackers

From 曾文旌
Subject Re: [Proposal] Global temporary tables
Date
Msg-id 2F189BEB-53CC-4331-A98A-8248E065047B@alibaba-inc.com
Whole thread Raw
In response to Re: [Proposal] Global temporary tables  (Prabhat Sahu <prabhat.sahu@enterprisedb.com>)
List pgsql-hackers


2020年4月24日 下午3:28,Prabhat Sahu <prabhat.sahu@enterprisedb.com> 写道:

Hi Wenjing, 

With the new patch(v30) as you mentioned the new syntax support for "TRUNCATE TABLE gtt DROP", but we also observe the syntax "DROP TABLE gtt DROP" is working as below:

postgres=# create global temporary table gtt(c1 int) on commit preserve rows;
CREATE TABLE
postgres=# DROP TABLE gtt DROP;
DROP TABLE
Fixed in v31.
The truncate GTT drop was also removed.


Wenjing




Does this syntax intensional? If not, we should get a syntax error.

On Fri, Apr 24, 2020 at 10:25 AM Prabhat Sahu <prabhat.sahu@enterprisedb.com> wrote:
Hi Wenjing,

Please check, the server getting crash with the below scenario(CLUSTER gtt using INDEX).

-- Session1:
postgres=# create global temporary table gtt (c1 integer) on commit preserve rows;
CREATE TABLE
postgres=# create index idx1 on gtt (c1);
CREATE INDEX

-- Session2:
postgres=# create index idx2 on gtt (c1);
CREATE INDEX

-- Session1:
postgres=# cluster gtt using idx1;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!?>

-- Below is the stacktrace:
[edb@localhost bin]$ gdb -q -c data/core.95690 postgres
Reading symbols from /home/edb/PG/PGsrcNew/postgresql/inst/bin/postgres...done.
[New LWP 95690]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `postgres: edb postgres [local] CLUSTER                    '.
Program terminated with signal 6, Aborted.
#0  0x00007f9c574ee337 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_7.2.x86_64 libcom_err-1.42.9-16.el7.x86_64 libgcc-4.8.5-39.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64
(gdb) bt
#0  0x00007f9c574ee337 in raise () from /lib64/libc.so.6
#1  0x00007f9c574efa28 in abort () from /lib64/libc.so.6
#2  0x0000000000ab3a3c in ExceptionalCondition (conditionName=0xb5e2e8 "!ReindexIsProcessingIndex(indexOid)", errorType=0xb5d365 "FailedAssertion",
    fileName=0xb5d4e9 "index.c", lineNumber=3825) at assert.c:67
#3  0x00000000005b0412 in reindex_relation (relid=16384, flags=2, options=0) at index.c:3825
#4  0x000000000065e36d in finish_heap_swap (OIDOldHeap=16384, OIDNewHeap=16389, is_system_catalog=false, swap_toast_by_content=false,
    check_constraints=false, is_internal=true, frozenXid=491, cutoffMulti=1, newrelpersistence=103 'g') at cluster.c:1448
#5  0x000000000065ccef in rebuild_relation (OldHeap=0x7f9c589adef0, indexOid=16387, verbose=false) at cluster.c:602
#6  0x000000000065c757 in cluster_rel (tableOid=16384, indexOid=16387, options=0) at cluster.c:418
#7  0x000000000065c2cf in cluster (stmt=0x2cd1600, isTopLevel=true) at cluster.c:180
#8  0x000000000093b213 in standard_ProcessUtility (pstmt=0x2cd16c8, queryString=0x2cd0b30 "cluster gtt using idx1;", context=PROCESS_UTILITY_TOPLEVEL,
    params=0x0, queryEnv=0x0, dest=0x2cd19a8, qc=0x7ffcd32604b0) at utility.c:819
#9  0x000000000093aa50 in ProcessUtility (pstmt=0x2cd16c8, queryString=0x2cd0b30 "cluster gtt using idx1;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
    queryEnv=0x0, dest=0x2cd19a8, qc=0x7ffcd32604b0) at utility.c:522
#10 0x00000000009398c2 in PortalRunUtility (portal=0x2d36ba0, pstmt=0x2cd16c8, isTopLevel=true, setHoldSnapshot=false, dest=0x2cd19a8, qc=0x7ffcd32604b0)
    at pquery.c:1157
#11 0x0000000000939ad8 in PortalRunMulti (portal=0x2d36ba0, isTopLevel=true, setHoldSnapshot=false, dest=0x2cd19a8, altdest=0x2cd19a8, qc=0x7ffcd32604b0)
    at pquery.c:1303
#12 0x0000000000938ff6 in PortalRun (portal=0x2d36ba0, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x2cd19a8, altdest=0x2cd19a8,
    qc=0x7ffcd32604b0) at pquery.c:779
#13 0x00000000009331b0 in exec_simple_query (query_string=0x2cd0b30 "cluster gtt using idx1;") at postgres.c:1239
#14 0x00000000009371bc in PostgresMain (argc=1, argv=0x2cfab80, dbname=0x2cfaa78 "postgres", username=0x2cfaa58 "edb") at postgres.c:4315
#15 0x00000000008872a9 in BackendRun (port=0x2cf2b50) at postmaster.c:4510
#16 0x0000000000886a9e in BackendStartup (port=0x2cf2b50) at postmaster.c:4202
#17 0x000000000088301c in ServerLoop () at postmaster.c:1727
#18 0x00000000008828f3 in PostmasterMain (argc=3, argv=0x2ccb460) at postmaster.c:1400
#19 0x0000000000789c54 in main (argc=3, argv=0x2ccb460) at main.c:210
(gdb) 


--

With Regards,
Prabhat Kumar Sahu
EnterpriseDB: http://www.enterprisedb.com



--

With Regards,
Prabhat Kumar Sahu
EnterpriseDB: http://www.enterprisedb.com


Attachment

pgsql-hackers by date:

Previous
From: 曾文旌
Date:
Subject: Re: [Proposal] Global temporary tables
Next
From: 曾文旌
Date:
Subject: Re: [Proposal] Global temporary tables