Thread

  1. the oid is uknown during execution of rule..insert ? (psql ver 6.5.2)

    Daniel Péder <dpeder@infoset.cz> — 1999-10-13T17:50:40Z

    mydb=> create table roid (roid oid, rtext text);
    CREATE
    mydb=> create table rtext ( rtext text );
    CREATE
    mydb=> create rule roidset as on insert to rtext do insert into roid values ( new.oid, new.rtext );
    CREATE
    mydb=> insert into rtext values('text1');
    INSERT 17681 1
    mydb=> insert into rtext values('text2');
    INSERT 17683 1
    mydb=> insert into rtext values('text3');
    INSERT 17685 1
    mydb=> select oid,* from rtext;
      oid|rtext
    -----+-----
    17681|text1
    17683|text2
    17685|text3
    (3 rows)
    
    mydb=> select oid,* from roid;
      oid|roid|rtext
    -----+----+-----
    17680|    |text1
    17682|    |text2
    17684|    |text3
    (3 rows)