

/****************************************************
 *  TABLE:  history_tracking
 */
CREATE SEQUENCE "history_tracking_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 cycle;

create table history_tracking (
  history_tracking_id int4 DEFAULT nextval('history_tracking_id_seq'::text)
                           PRIMARY KEY,
  history_timestamp timestamp NOT NULL
                              DEFAULT now(),
  history_dblogin name NOT NULL
                       DEFAULT session_user
);




CREATE TABLE "temp_table" ( id SERIAL, name varchar(60), other varchar(200));

CREATE TABLE "temp_table_test" ( id SERIAL, name varchar(60), other varchar(200));




CREATE FUNCTION generate_history() RETURNS OPAQUE 
AS '/usr/home/rbt/temp/postgresql-7.1beta4/contrib/user_account/history.so'
language 'C';


CREATE TRIGGER generate_history_trg AFTER INSERT OR DELETE OR UPDATE
ON temp_table
FOR EACH row
EXECUTE PROCEDURE generate_history();

INSERT INTO temp_table (name, other) values ('Rod', 'Other things');


