Re: [HACKERS] CREATE TABLE ... PRIMARY KEY kills backend

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] CREATE TABLE ... PRIMARY KEY kills backend
Date: 2000-01-12 12:24:14
Message-ID: 200001121224.MAA06987@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Oliver Elphick" wrote:
>I don't have any line number info, so I'll have to rebuild in order to
>do more detailed tracing.

QUERY: create table oljunk (id char(2) primary key, name text);

(gdb) n
134 _outNode(str, node->raw_default);
(gdb) p *str
$25 = {
data = 0x81dd788 "{ QUERY :command 5 :create oljunk { CREATE :relname oljunk :istemp false \t:columns ({ COLUMNDEF :colname id :typename { TYPENAME :name bpchar :timezone false :setof false typmod 6 :arrayBounds :arr"..., len = 263,
maxlen = 512}
(gdb) n
135 appendStringInfo(str, " :cooked_default %s :constraints ",
(gdb) n
137 _outNode(str, node->constraints);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x400f068a in _IO_default_xsputn () from /lib/libc.so.6

This is the backtrace before calling _outNode() at 137:
#0 _outColumnDef (str=0xbfffe8cc, node=0x81dd610) at outfuncs.c:137
str = 0xbfffe8cc
node = (ColumnDef *) 0x81dd610
#1 0x80c43da in _outNode (str=0xbfffe8cc, obj=0x81dd610) at outfuncs.c:1355
str = 0xbfffe8cc
obj = (void *) 0x81dd610
#2 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd970) at outfuncs.c:1336
l = (List *) 0x81dd970
str = 0xbfffe8cc
obj = (void *) 0x81dd970
#3 0x80c21ac in _outCreateStmt (str=0xbfffe8cc, node=0x81dd7b8)
at outfuncs.c:74
str = 0xbfffe8cc
node = (CreateStmt *) 0x81dd7b8
#4 0x80c43ba in _outNode (str=0xbfffe8cc, obj=0x81dd7b8) at outfuncs.c:1348
str = 0xbfffe8cc
obj = (void *) 0x81dd7b8
#5 0x80c2588 in _outQuery (str=0xbfffe8cc, node=0x81dd8e8) at outfuncs.c:185
str = 0xbfffe8cc
node = (Query *) 0x81dd8e8
#6 0x80c440a in _outNode (str=0xbfffe8cc, obj=0x81dd8e8) at outfuncs.c:1364
str = 0xbfffe8cc
obj = (void *) 0x81dd8e8
#7 0x80c480d in nodeToString (obj=0x81dd8e8) at outfuncs.c:1570
obj = (void *) 0x81dd8e8
str = {
data = 0x81ddc20 "{ QUERY :command 5 :create oljunk { CREATE :relname oljunk :istemp false \t:columns ({ COLUMNDEF :colname id :typename { TYPENAME :name bpchar :timezone false :setof false typmod 6 :arrayBounds :arr"..., len = 298,
maxlen = 512}
#8 0x80ed7a1 in pg_parse_and_plan (
query_string=0x8184da0 "create table oljunk (id char(2) primary key, name text)", typev=0x0, nargs=0, queryListP=0xbfffe97c, dest=Remote,
aclOverride=0 '\000') at postgres.c:435
query_string = 0x81dd8e8 "X\002"
aclOverride = 0 '\000'
querytree_list = (List *) 0x81dd8e8
plan_list = (List *) 0x0
querytree_list_item = (List *) 0x81dda60
querytree = (Query *) 0x81dd8e8
plan = (Plan *) 0x81dd8e8
new_list = (List *) 0x0
rewritten = (List *) 0xf5

Now we run on a bit, and we go into a recursive loop inside _outNode:

_outNode (str=0xbfffe8cc, obj=0x81dd9a0) at outfuncs.c:1323
1323 if (obj == NULL)
(gdb) p *str
$21 = {
data = 0x81dde28 "{ QUERY :command 5 :create oljunk { CREATE :relname oljunk :istemp false \t:columns ({ COLUMNDEF :colname id :typename { TYPENAME :name bpchar :timezone false :setof false typmod 6 :arrayBounds :arrayBounds <>} :is_not_null true :is_sequence false :raw_default <> :cooked_default <> :constraints ({ oljunk_pkey :type PRIMARY KEY ({ COLUMNDEF :colname id :typename { TYPENAME :name bpchar :timezone false :setof false typmod 6 :arrayBounds :arrayBounds <>} :is_not_null true :is_sequence false :raw_default <> :cooked_default <> :constraints ({ oljunk_pkey :type PRIMARY KEY ({ COLUMNDEF :colname id :typename { TYPENAME :name bpchar :timezone false :setof false typmod 6 :arrayBounds :arrayBounds <>} :is_not_null true :is_sequence false :raw_default <> :cooked_default <> :constraints ({ oljunk_pkey :type PRIMARY KEY ", len = 823, maxlen = 1024}
(gdb)

(gdb) bt
#0 _outNode (str=0xbfffe8cc, obj=0x81dd9a0) at outfuncs.c:1323
#1 0x80c3f8a in _outConstraint (str=0xbfffe8cc, node=0x81dd5e8)
at outfuncs.c:1283
#2 0x80c476a in _outNode (str=0xbfffe8cc, obj=0x81dd5e8) at outfuncs.c:1528
#3 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd660) at outfuncs.c:1336
#4 0x80c2406 in _outColumnDef (str=0xbfffe8cc, node=0x81dd610)
at outfuncs.c:137
#5 0x80c43da in _outNode (str=0xbfffe8cc, obj=0x81dd610) at outfuncs.c:1355
#6 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd9a0) at outfuncs.c:1336
#7 0x80c3f8a in _outConstraint (str=0xbfffe8cc, node=0x81dd5e8)
at outfuncs.c:1283
#8 0x80c476a in _outNode (str=0xbfffe8cc, obj=0x81dd5e8) at outfuncs.c:1528
#9 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd660) at outfuncs.c:1336
#10 0x80c2406 in _outColumnDef (str=0xbfffe8cc, node=0x81dd610)
at outfuncs.c:137
#11 0x80c43da in _outNode (str=0xbfffe8cc, obj=0x81dd610) at outfuncs.c:1355
#12 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd9a0) at outfuncs.c:1336
#13 0x80c3f8a in _outConstraint (str=0xbfffe8cc, node=0x81dd5e8)
at outfuncs.c:1283
#14 0x80c476a in _outNode (str=0xbfffe8cc, obj=0x81dd5e8) at outfuncs.c:1528
#15 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd660) at outfuncs.c:1336
#16 0x80c2406 in _outColumnDef (str=0xbfffe8cc, node=0x81dd610)
at outfuncs.c:137
#17 0x80c43da in _outNode (str=0xbfffe8cc, obj=0x81dd610) at outfuncs.c:1355
#18 0x80c408c in _outNode (str=0xbfffe8cc, obj=0x81dd970) at outfuncs.c:1336
#19 0x80c21ac in _outCreateStmt (str=0xbfffe8cc, node=0x81dd7b8)
at outfuncs.c:74
#20 0x80c43ba in _outNode (str=0xbfffe8cc, obj=0x81dd7b8) at outfuncs.c:1348
#21 0x80c2588 in _outQuery (str=0xbfffe8cc, node=0x81dd8e8) at outfuncs.c:185
#22 0x80c440a in _outNode (str=0xbfffe8cc, obj=0x81dd8e8) at outfuncs.c:1364
#23 0x80c480d in nodeToString (obj=0x81dd8e8) at outfuncs.c:1570
#24 0x80ed7a1 in pg_parse_and_plan (
query_string=0x8184da0 "create table oljunk (id char(2) primary key, name text)", typev=0x0, nargs=0, queryListP=0xbfffe97c, dest=Remote,
aclOverride=0 '\000') at postgres.c:435

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"For the LORD is good; his mercy is everlasting; and
his truth endureth to all generations."
Psalms 100:5

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2000-01-12 13:14:01 Re: [HACKERS] CREATE TABLE ... PRIMARY KEY kills backend
Previous Message Adriaan Joubert 2000-01-12 11:20:15 Re: [HACKERS] BlowAwayRelationBuffers