BEGIN;

CREATE TABLE a (aid SERIAL PRIMARY KEY, comment TEXT);

CREATE TABLE b (aid INT, bid SERIAL, PRIMARY KEY (aid, bid), FOREIGN KEY (aid) REFERENCES a);

CREATE RULE "insert_as_into_b" AS ON INSERT TO a DO ALSO INSERT INTO b (aid) VALUES (NEW.aid);

INSERT INTO a (comment) VALUES ('Testing');
