Subject: Problems with rules

From: Kent Archie <[email-masked]>
Date: Wed, 23 Jun 93 23:44:02 CDT

I'm not quite sure how to describe this but here goes.
Here is some trace output, annotated in a way that I hope explains it.

AFTER INITIAL PARSE
in get_status
--- the code for these piece is like
---   res = PQexec("...");
get_status: res = :CBEGIN:      --- result of PQexec("begin")
get_status: res = :CRETRIEVE:   --- result of PQexec("retrieve portal kent ...")
get_status: fetch res = :Pkent: --- result of PQexec("fetch all in kent")
out get_status

--- this is all as I expect.
--- then some normal stuff happens

cwf=:add2^junk/add2^add2.ada: cwv=2
db_st_writenode:cwf=:add2^junk/add2^add2.ada: cwv=2
put_struct: node number = 1
array2str: returning :{2,3,4,5,9,10,21}:

--- then I append a record with the command shown below
put_struct: Buf = :append amt_struct_tree (file_id="add2^junk/add2^add2.ada",num
ber= 1,ntype=351,value="",parent=0,children="{2,3,4,5,9,10,21}", lineno=3,column
=1,label="",name="test"): length = 165
put_struct: res = :CAPPEND 28960:     --- and this is the result
--- again, this is what I expect
--- there is a rule attached to the amt_struct_tree table that is triggered
--- if the file_id attribute is "NOFILE"
--- it appends an error note using a C function in the where clause to
--- take some other action
--- the rule is:

define function nofile
	   (language = "c",returntype = bool)
	   arg is (amt_struct_tree)
	   as "/home/ginko/kca/phd/amt/nofile.o" \g

	define rewrite rule check_idf is
	on append to amt_struct_tree where new.file_id = "NOFILE"
	do append amt_errors(file_id = current.file_id,error = "NOFILE") 
	   where nofile(new) \g

--- Note: I know that in this case current.file_id = "NOFILE"
					 w)\g

--- after this, we start again with get_status

in get_status
get_status: begin res = :CAPPEND 0:  
--- this appears to be the result of the append that is part of the rule.
--- the rule is not fired (I think) as none of the actions
--- in the C function are done and there is no record appended to the
--- error table.
get_status: res = :CBEGIN:   --- result of the retrieve
get_status: fetch res = :CRETRIEVE:	--- result of the fetch
try2[20]: 9469 Memory fault(coredump)

this is the trace from dbx
ginko>dbx pgparse
Reading symbolic information...
Read 10999 symbols
program terminated by signal SEGV (no mapping at the fault address)
(dbx) where
pbuf_findGroup() at 0x29ff4
PQnfieldsGroup() at 0x2a380
get_status(), line 826 in "amtlib.c"
db_st_writenode(node = 0xa2238, ver = 0), line 117 in "db_stree.c"
nt_trav2(ver = 0, bnode = 0xa1fc0, func = &db_st_writenode() at 0x18cd8), line 2
69 in "ndtable.c"
nt_trav2(ver = 0, bnode = 0xa1eb0, func = &db_st_writenode() at 0x18cd8), line 2
72 in "ndtable.c"
nt_traverse(ver = 0, func = &db_st_writenode() at 0x18cd8), line 295 in "ndtable
.c"
cmdline(argc = 3, argv = 0xf7fffd64), line 256 in "main.c"
main(argc = 3, argv = 0xf7fffd64), line 327 in "main.c"

Line 826 in get_status() is the PQexec("fetch...");

Any ideas?
Any other info I can provide?
**kent
Kent Archie
[email-masked]