BUG #16616: Segmentation fault when use explain - Mailing list pgsql-bugs
From | PG Bug reporting form |
---|---|
Subject | BUG #16616: Segmentation fault when use explain |
Date | |
Msg-id | 16616-a0b27501abf6e83a@postgresql.org Whole thread Raw |
Responses |
Re: BUG #16616: Segmentation fault when use explain
|
List | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 16616 Logged by: Dan Liu Email address: 139250065@qq.com PostgreSQL version: 12.4 Operating system: 18.04.5 LTS (Bionic Beaver) Description: I created a extension by C language, and deltatype is a new data type CREATE TYPE deltatype; CREATE FUNCTION deltatype_in(cstring) RETURNS deltatype IMMUTABLE STRICT LANGUAGE C AS '$libdir/bz', 'deltatype_in'; CREATE FUNCTION deltatype_out(deltatype) RETURNS cstring IMMUTABLE STRICT LANGUAGE C AS '$libdir/bz', 'deltatype_out'; CREATE FUNCTION deltatype_receive(internal) RETURNS deltatype IMMUTABLE STRICT LANGUAGE C AS '$libdir/bz', 'deltatype_receive'; CREATE FUNCTION deltatype_send(deltatype) RETURNS bytea IMMUTABLE STRICT LANGUAGE C AS '$libdir/bz', 'deltatype_send'; CREATE TYPE deltatype ( INPUT = deltatype_in, OUTPUT = deltatype_out, RECEIVE = deltatype_receive, SEND = deltatype_send, INTERNALLENGTH = 1, ALIGNMENT = char, PASSEDBYVALUE ); It works well execpt when I use explain in psql > explain select 'new'::deltatype <> 'old'::deltatype; QUERY PLAN ------------------------------------------ Result (cost=0.00..0.01 rows=1 width=1) (1 row) > explain select * from contract_index64s where delta_type <> 0 limit 1; QUERY PLAN -------------------------------------------------------------------------------- Limit (cost=0.00..0.03 rows=1 width=57) -> Seq Scan on contract_index64s (cost=0.00..4424.69 rows=147405 width=57) Filter: (delta_type <> 0) (3 rows) > explain select * from contract_index64s where delta_type <> 'new'::text limit 1; QUERY PLAN ------------------------------------------------------------------------------- Limit (cost=0.00..0.10 rows=1 width=57) -> Seq Scan on contract_index64s (cost=0.00..4424.69 rows=44537 width=57) Filter: (delta_type <> 'new'::text) (3 rows) > select * from contract_index64s where delta_type <> 'new'::deltatype limit 1; block_num | seq_no | delta_type | code | scope | tab | primary_key | payer | secondary_key -----------+--------+------------+------------+------------+------------+-------------+------------+--------------- 13698527 | 0 | removed | snatchgame | snatchgame | snatchgame | 0 | snatchgame | 1 (1 row) Time: 3.863 ms > explain select * from contract_index64s where delta_type <> 'new'::deltatype limit 1; 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. Time: 118.896 ms 10:21:53 (@:)!>? in log file: /var/log/postgresql/postgresql-12-main.log 2020-09-15 10:21:53.143 CST::@:[858]: LOG: server process (PID 2902) was terminated by signal 11: Segmentation fault 2020-09-15 10:21:53.143 CST::@:[858]: DETAIL: Failed process was running: explain select * from contract_index64s where delta_type <> 'new'::deltatype limit 1; 2020-09-15 10:21:53.143 CST::@:[858]: LOG: terminating any other active server processes 2020-09-15 10:21:53.143 CST:[local]:baozi@baozi_db:[3256]: FATAL: the database system is in recovery mode 2020-09-15 10:21:53.144 CST::@:[925]: WARNING: terminating connection because of crash of another server process 2020-09-15 10:21:53.144 CST::@:[925]: DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. 2020-09-15 10:21:53.144 CST::@:[925]: HINT: In a moment you should be able to reconnect to the database and repeat your command. 2020-09-15 10:21:53.145 CST::@:[858]: LOG: all server processes terminated; reinitializing 2020-09-15 10:21:53.180 CST::@:[3259]: LOG: database system was interrupted; last known up at 2020-09-15 10:05:38 CST 2020-09-15 10:21:53.180 CST::@:[3259]: LOG: database system was not properly shut down; automatic recovery in progress 2020-09-15 10:21:53.182 CST::@:[3259]: LOG: redo starts at 4F/15D550 2020-09-15 10:21:53.182 CST::@:[3259]: LOG: invalid record length at 4F/15D638: wanted 24, got 0 2020-09-15 10:21:53.182 CST::@:[3259]: LOG: redo done at 4F/15D600 2020-09-15 10:21:53.191 CST::@:[858]: LOG: database system is ready to accept connections
pgsql-bugs by date: