-- pgAdmin II v1.4.12 Database Schema Dump

-- pgSchema:  1.4.12
-- Timestamp: 16/01/2003 11:58:16
-- Server:    emsdev
-- Port:      8059
-- Database:  test


-- Sequence: blah_id_seq
CREATE SEQUENCE blah_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1;
SELECT setval('blah_id_seq', 3);

-- Table: blah
CREATE TABLE blah (
  id int4 DEFAULT nextval('"blah_id_seq"'::text) NOT NULL, 
  name varchar(10) NOT NULL, 
  CONSTRAINT blah_id_key UNIQUE (id), 
  CONSTRAINT blah_pkey PRIMARY KEY (id, name)
) WITH OIDS;



-- Function: test_funct()
CREATE FUNCTION test_funct() RETURNS opaque AS 'BEGIN

IF ( NEW.name = ''GEOFF'' ) THEN

  RAISE NOTICE ''HI (%)'', NEW.name;

END IF;

RETURN NEW;

END'  LANGUAGE 'plpgsql';

-- Trigger: test_trig ON blah
CREATE TRIGGER test_trig AFTER INSERT ON blah FOR EACH ROW EXECUTE PROCEDURE test_funct();


-- Insert The test datat AFTER GEOFF IS INSERTED YOU SHOULD SEE " NOTICE:  HI (GEOFF) "
INSERT INTO blah ( name ) VALUES ('PETE');
INSERT INTO blah ( name ) VALUES ('GEOFF');


-- DROP THE FUNCTION
DROP FUNCTION test_funct();

-- DROP THE FUNCTION 
DROP TRIGGER test_trig ON blah;

