Hi,
many clients like webmin and openoffice makes an
INSERT .... NULL if i give no value for a field because it is a sequence.
Is there a better way to solve this problem as using a trigger ?
CREATE TABLE test (
id integer PRIMARY KEY
);
CREATE SEQUENCE test_seq_id MINVALUE 0;
CREATE OR REPLACE FUNCTION test_fnc_id_seq() RETURNS TRIGGER AS
'
begin
NEW.id := nextval(''test_seq_id'');
RETURN NEW;
end;
'
LANGUAGE 'plpgsql';
CREATE TRIGGER test_trg_ins BEFORE INSERT ON test FOR EACH ROW
EXECUTE PROCEDURE test_fnc_id_seq();
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster