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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to