Bug in RI - Mailing list pgsql-hackers

From Jeroen van Vianen
Subject Bug in RI
Date
Msg-id 4.3.2.7.2.20000921173840.00b36ee0@imap.satama.nl
Whole thread Raw
Responses Re: Bug in RI
List pgsql-hackers
Hi,

I encountered the following problem:

./configure --enable-debug --prefix=/opt/postgres
Edit config.h: BLCKSZ 32768

postgres=# select version();                            version
--------------------------------------------------------------- PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc
2.95.2
(1 row)

I have the following table:

CREATE TABLE "folders" (        "nr" int4 NOT NULL,        "parent" int4,        "name" character varying(100) NOT
NULL,       "lang" character varying(2) NOT NULL,        "sort_order" int2 DEFAULT 0 NOT NULL,        "stylesheet"
charactervarying(100),        "introduction" character varying(1000),        "template" character varying(100) NOT
NULL,       "img_normal" character varying(50),        "img_over" character varying(50),        "img_active" character
varying(50),       PRIMARY KEY ("nr")
 
);

CREATE CONSTRAINT TRIGGER "fk_folders__parent" AFTER INSERT OR UPDATE ON 
"folders"  NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE 
PROCEDURE "RI_FKey_check_ins" ('fk_folders__parent', 'folders', 'folders', 
'UNSPECIFIED', 'parent', 'nr');

CREATE CONSTRAINT TRIGGER "fk_folders__parent" AFTER DELETE ON 
"folders"  NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE 
PROCEDURE "RI_FKey_noaction_del" ('fk_folders__parent', 'folders', 
'folders', 'UNSPECIFIED', 'parent', 'nr');

CREATE CONSTRAINT TRIGGER "fk_folders__parent" AFTER UPDATE ON 
"folders"  NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE 
PROCEDURE "RI_FKey_noaction_upd" ('fk_folders__parent', 'folders', 
'folders', 'UNSPECIFIED', 'parent', 'nr');


If I do the following query:

update folders set title='Sitemap' where nr=43;

I get the following error in the log:

Server process (pid 31566) exited with status 139 at Thu Sep 21 17:24:39 2000
Terminating any active server processes...
Server processes were terminated at Thu Sep 21 17:24:39 2000
Reinitializing shared memory and semaphores
The Data Base System is starting up
DEBUG:  Data Base System is starting up at Thu Sep 21 17:24:39 2000
DEBUG:  Data Base System was interrupted being in production at Thu Sep 21 
17:24:25 2000
DEBUG:  Data Base System is in production state at Thu Sep 21 17:24:39 2000

and the following error in psql:

pqReadData() -- backend closed the channel unexpectedly.        This probably means the backend terminated abnormally
    before or while processing the request.
 

A backtrace says:

#0  ri_BuildQueryKeyFull (key=0xbfffe4c8, constr_id=21463, constr_queryno=0,    fk_rel=0x0, pk_rel=0x8217c20, argc=6,
argv=0x821a9e0)at 
 
ri_triggers.c:2951
2951            key->fk_relid = fk_rel->rd_id;

(gdb) bt
#0  ri_BuildQueryKeyFull (key=0xbfffe4c8, constr_id=21463, constr_queryno=0,    fk_rel=0x0, pk_rel=0x8216780, argc=6,
argv=0x8219540)at 
 
ri_triggers.c:2951
#1  0x813292e in RI_FKey_keyequal_upd () at ri_triggers.c:2853
#2  0x809cfe2 in DeferredTriggerSaveEvent (rel=0x8216780, event=2,    oldtup=0x8227bb0, newtup=0x8227ac8) at
trigger.c:1904
#3  0x809c0ed in ExecARUpdateTriggers (estate=0x8225dc8, tupleid=0xbfffe668,    newtuple=0x8227ac8) at trigger.c:915
#4  0x80a36a6 in ExecReplace (slot=0x82261e8, tupleid=0xbfffe668,    estate=0x8225dc8) at execMain.c:1591
#5  0x80a3261 in ExecutePlan (estate=0x8225dc8, plan=0x8225cb8,    operation=CMD_UPDATE, offsetTuples=0,
numberTuples=0,   direction=ForwardScanDirection, destfunc=0x8227a60) at execMain.c:1213
 
#6  0x80a27be in ExecutorRun (queryDesc=0x8226048, estate=0x8225dc8,    feature=3, limoffset=0x0, limcount=0x0) at
execMain.c:327
#7  0x8101f84 in ProcessQueryDesc (queryDesc=0x8226048, limoffset=0x0,    limcount=0x0) at pquery.c:310
#8  0x8102017 in ProcessQuery (parsetree=0x820a840, plan=0x8225cb8,    dest=Remote) at pquery.c:353
#9  0x8100839 in pg_exec_query_dest (    query_string=0x81bae28 "update folders set name='Sitemap' where nr=43;",
dest=Remote,aclOverride=0) at postgres.c:663
 
#10 0x81006fa in pg_exec_query (    query_string=0x81bae28 "update folders set name='Sitemap' where nr=43;")    at
postgres.c:562
#11 0x81018c3 in PostgresMain (argc=4, argv=0xbfffed80, real_argc=5,    real_argv=0xbffff734) at postgres.c:1590
#12 0x80e9727 in DoBackend (port=0x81c00d8) at postmaster.c:2009
#13 0x80e92da in BackendStartup (port=0x81c00d8) at postmaster.c:1776
#14 0x80e8499 in ServerLoop () at postmaster.c:1037
#15 0x80e7e5e in PostmasterMain (argc=5, argv=0xbffff734) at postmaster.c:725
#16 0x80b485b in main (argc=5, argv=0xbffff734) at main.c:93


Any ideas? If you need any additional info, please let me know.



Jeroen



pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: INSERT/UPDATE/DELETE
Next
From: Stephan Szabo
Date:
Subject: Re: Bug in RI