Thread

  1. Backend crash trying to delete rows

    PostgreSQL Bugs List <pgsql-bugs@postgresql.org> — 2000-09-09T06:29:44Z

    Andrea Aime (aaime@comune.modena.it) reports a bug with a severity of 3
    The lower the number the more severe it is.
    
    Short Description
    Backend crash trying to delete rows
    
    Long Description
    Platform: RedHat 6.2, PostgreSQL 7.02 compiled by gcc egcs 2.91.66,
    running on a PIII 733Mhz, 128 MB RAM, 9 GB SCSI HD.
    
    Create an empty database and then two table, a master and a slave,
    slave references master primary key with an on delete cascade 
    fk option. Everything runs fine, when you delete rows in master
    table you get also corresponding slave rows deleted. Now rename
    slave into slave2 and retry delete: backend crashes.
    FK are part of table structure, you can implement them as trigger
    but they must follow any table modification, otherwise schema 
    evolution is not possible.
    
    Sample Code
    I put here some code just to give you an idea, I haven't
    tried it.
    
    create table master(
      id_master serial,
      name varchar,
      primary key(id_master)
    );
    
    create table slave(
      id_slave serial,
      id_master int4,
      primary key(id_slave),
      foreign key(id_master) references master(id_master) on delete cascade
    );
    
    insert into master(name) values('Andrew');
    insert into slave(id_master,slave) values(1,'Rod');
    
    #this one works fine
    delete from master;
    
    alter table slave rename to slave2;
    
    insert into master(name) values('Andrew');
    insert into slave(id_master,slave) values(2,'Rod');
    
    #boom!
    delete from master;
    
    No file was uploaded with this report
    
    
    
  2. Re: Backend crash trying to delete rows

    Stephan Szabo <sszabo@megazone23.bigpanda.com> — 2000-09-09T16:43:31Z

    This is a known bug.  Current sources will not crash, but will
    instead fail the query (since they are still referencing the name).
    By 7.2, the ri triggers should probably be following the oid
    of the tables and columns and will be safe from renames.
    
    Stephan Szabo
    sszabo@bigpanda.com
    
    On Sat, 9 Sep 2000 pgsql-bugs@postgresql.org wrote:
    
    > Andrea Aime (aaime@comune.modena.it) reports a bug with a severity of 3
    > The lower the number the more severe it is.
    > 
    > Short Description
    > Backend crash trying to delete rows
    > 
    > Long Description
    > Platform: RedHat 6.2, PostgreSQL 7.02 compiled by gcc egcs 2.91.66,
    > running on a PIII 733Mhz, 128 MB RAM, 9 GB SCSI HD.
    > 
    > Create an empty database and then two table, a master and a slave,
    > slave references master primary key with an on delete cascade 
    > fk option. Everything runs fine, when you delete rows in master
    > table you get also corresponding slave rows deleted. Now rename
    > slave into slave2 and retry delete: backend crashes.
    > FK are part of table structure, you can implement them as trigger
    > but they must follow any table modification, otherwise schema 
    > evolution is not possible.
    > 
    > Sample Code
    > I put here some code just to give you an idea, I haven't
    > tried it.
    > 
    > create table master(
    >   id_master serial,
    >   name varchar,
    >   primary key(id_master)
    > );
    > 
    > create table slave(
    >   id_slave serial,
    >   id_master int4,
    >   primary key(id_slave),
    >   foreign key(id_master) references master(id_master) on delete cascade
    > );
    > 
    > insert into master(name) values('Andrew');
    > insert into slave(id_master,slave) values(1,'Rod');
    > 
    > #this one works fine
    > delete from master;
    > 
    > alter table slave rename to slave2;
    > 
    > insert into master(name) values('Andrew');
    > insert into slave(id_master,slave) values(2,'Rod');
    > 
    > #boom!
    > delete from master;