Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pg core dump
# i modified
if (att->atthasmissing) -> if (! att->atthasmissing)
recompiled and make install
./configure --prefix /home/postgres/example/pgsql --enable-debug 2>&1 >/dev/null
make install
then ran the test to reproduce
postgres@db:~/example$ ulimit -c
postgres@db:~/example$ export PATH=/home/postgres/.pyenv/shims:/home/postgres/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/postgres/example/pgsql/bin
postgres@db:~/example$ pg_ctl -D example -l logfile stop waiting for server to shut down.... done
server stopped
postgres@db:~/example$ pg_ctl -D example -l logfile start
waiting for server to start.... done
server started
postgres@db:~/example$ psql
psql (13.3)
Type "help" for help.
postgres=# drop table t1;
postgres=# CREATE TABLE t1 AS
SELECT 1::int AS a , 2::int AS b
FROM generate_series(1,20) q;
postgres=# ALTER TABLE t1 ADD COLUMN c text;
postgres=# SELECT a,
stddev(cast((SELECT sum(1) FROM generate_series(1,20) x) AS float4))
AS z
FROM t1;
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: Succeeded.
postgres=# \q
postgres@db:~/example$ ls -lrt
total 175612
drwx------ 19 postgres postgres 4096 Jun 30 14:20 example
-rw------- 1 postgres postgres 151969792 Jun 30 14:20 core.1000.postgres.23620
postgres@db:~/example$ chmod a+rwx core.1000.postgres.23620
postgres@db:~/example$ sudo gdb /home/postgres/example/pgsql/bin/postgres /home/postgres/example/core.1000.postgres.23620
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/postgres/example/pgsql/bin/postgres...
[New LWP 23620]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".
Core was generated by `postgres: postgres postgres [local] SELECT '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055b0342c3771 in getmissingattr () -- right at the place where i made that change
(gdb) bt
#0 0x000055b0342c3771 in getmissingattr ()
#1 0x000055b0346c0f4f in comparetup_heap ()
#2 0x000055b0346bddad in qsort_tuple ()
#3 0x000055b0346c3768 in tuplesort_performsort ()
#4 0x000055b034464038 in ExecSort ()
#5 0x000055b034467ff0 in begin_partition ()
#6 0x000055b03446b3b5 in ExecWindowAgg ()
#7 0x000055b0344389a3 in standard_ExecutorRun ()
#8 0x000055b03458f4bc in PortalRunSelect ()
#9 0x000055b0345906be in PortalRun ()
#10 0x000055b03458c42c in exec_simple_query ()
#11 0x000055b03458e012 in PostgresMain ()
#12 0x000055b034519fcf in ServerLoop ()
#13 0x000055b03451af2b in PostmasterMain ()
#14 0x000055b0342bacf2 in main ()
(gdb) quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment