Re: After insert trigger not work
От | Brilliantov Kirill Vladimirovich |
---|---|
Тема | Re: After insert trigger not work |
Дата | |
Msg-id | 5464C18D.509@byterg.ru обсуждение исходный текст |
Ответ на | After insert trigger not work (Brilliantov Kirill Vladimirovich <brilliantov@byterg.ru>) |
Список | pgsql-general |
Melvin Davidson wrote on 11/13/2014 05:29 PM: > s for > I suspect your problem is because you have 6 columns that are NOT NULL, but > on INSERT you are only supplying values for 4 columns plus the id(serial). > Therefore, the INSERT will fail. Perhaps if you supplied a value for > last_update you it will work a lot better. Hello, Melvin! Why this is a problem is last_update column created with default value? >> Trigger should update data in table: >> CREATE TABLE trassa.ram_free_stat >> ( >> id serial NOT NULL, >> device integer NOT NULL, >> min_value integer NOT NULL, >> avg_value integer NOT NULL DEFAULT 0, >> max_value integer NOT NULL, >> last_update timestamp without time zone NOT NULL DEFAULT now(), >> CONSTRAINT ram_free_stat_pk PRIMARY KEY (id), >> CONSTRAINT ram_free_stat_device_fk FOREIGN KEY (device) >> REFERENCES trassa.devices (id) MATCH SIMPLE >> ON UPDATE NO ACTION ON DELETE NO ACTION, >> CONSTRAINT ram_free_stat_max_fk FOREIGN KEY (max_value) >> REFERENCES trassa.ram (id) MATCH SIMPLE >> ON UPDATE NO ACTION ON DELETE NO ACTION, >> CONSTRAINT ram_free_stat_min_fk FOREIGN KEY (min_value) >> REFERENCES trassa.ram (id) MATCH SIMPLE >> ON UPDATE NO ACTION ON DELETE NO ACTION >> ) >> -- Best regards, Brilliantov Kirill Vladimirovich
В списке pgsql-general по дате отправления: