Thread: ERROR: unrecognized node type in PostgresMain( )

ERROR: unrecognized node type in PostgresMain( )

From
mchron@aueb.gr
Date:
Hi
I'm implementing a new join that needs 2 hash tables, one for each relation. 
I declared a
new type of node, DPHashJoin (with id T_DPHashJoin 121 at nodes.h) , which 
is by now the same as HashJoin
plan node.I created a new plan with two Hash nodes, something that looks 
like a symmetric hash join plan tree,
(I havent create the corresponding plan state tree at the executor yet). 

The problem is that while, Im running the postgres with gdb and I set a 
breakpoint at the function
create_plan() of createplan.c, after some step commands,the gdb says that it 
cant recongnize
the node 121 in the PostgresMain() function. I looked into that function but 
I cant see any
message like this :"unrecognized node type:".So I cant see where the proplem 
could be.(I saw as
well that the error didnt come from the execProcnode.c at the executor)

Do anyone has any idea what the problem could be? (That node is recognizable 
at the file I added code
(createplan.c) at the optimizer.) 

Please help. I dont know what to do. I send you the messages of the gdb. 
Please take a look. 


[postgres@localhost martha]$ gdb /usr/local/pgsql/bin/postgres
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) break create_plan
Breakpoint 1 at 0x811c7f1
(gdb) run -D /usr/local/pgsql/test test
Starting program: /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/test 
test

POSTGRES backend interactive interface
$Revision: 1.375.2.1 $ $Date: 2003/11/24 14:50:02 $

backend> select * from work,people where work.peoplesurname=people.surname 

CHEAPEST PATH: #506# #500# #121# #0.30..0.50..# 

Breakpoint 1, 0x0811c7f1 in create_plan ()
(gdb) step
Single stepping until exit from function create_plan,
which has no line number information.
martha: it is T_HashJoin or T_MergeJoin or T_NestLoop. Invoked function 
create_join_plan( ) 

Breakpoint 1, 0x0811c7f1 in create_plan ()
(gdb) step
Single stepping until exit from function create_plan,
which has no line number information.
martha: it is T_SeqScan. Invoked function create_seqscan_plan( )  //this is 
a printf that I added at the source code
0x0811caa7 in create_join_plan ()
(gdb) step
Single stepping until exit from function create_join_plan,
which has no line number information. 

Breakpoint 1, 0x0811c7f1 in create_plan ()
(gdb) step
Single stepping until exit from function create_plan,
which has no line number information.
martha: it is T_SeqScan. Invoked function create_seqscan_plan( )  //this is 
a printf that I added at the source code
0x0811cab6 in create_join_plan ()
(gdb) step
Single stepping until exit from function create_join_plan,
which has no line number information.
0x0811c892 in create_plan ()
(gdb) step
Single stepping until exit from function create_plan,
which has no line number information.
0x081209cb in grouping_planner ()
(gdb) step
Single stepping until exit from function grouping_planner,
which has no line number information.
0x08120253 in subquery_planner ()
(gdb) step
Single stepping until exit from function subquery_planner,
which has no line number information.
0x0811ff7c in planner ()
(gdb) step
Single stepping until exit from function planner,
which has no line number information.
ERROR:  unrecognized node type: 121
0x0814e09c in PostgresMain ()
(gdb) 

Thanks in advance !!!!!!!!!-Martha mc


Re: ERROR: unrecognized node type in PostgresMain( )

From
Tom Lane
Date:
mchron@aueb.gr writes:
> The problem is that while, Im running the postgres with gdb and I set a 
> breakpoint at the function
> create_plan() of createplan.c, after some step commands,the gdb says that it 
> cant recongnize
> the node 121 in the PostgresMain() function.

That's not what gdb said at all; all you know is that the error happened
someplace where you didn't have control.  (My bet is that control got as
far as executor startup, which you already said you hadn't fixed to
understand this new node type, so the error is exactly what I'd expect.)

Perhaps you should rebuild the backend with -g (see --enable-debug) so
that gdb can actually be somewhat helpful.  It's usually a good idea to
have --enable-cassert turned on when hacking C code, too.

FWIW, I don't personally ever do debugging in a standalone backend,
unless the problem is one that keeps a normal backend from starting.
It's much more pleasant to use a regular psql session to issue SQL
commands, and attach to the connected backend with gdb in another
terminal window.
        regards, tom lane