I have tables for invoice headers and rows:

CREATE TABLE invoiceheader ( id SERIAL PRIMARY KEY, .... );

CREATE TABLE invoicerow ( id SERIAL PRIMARY KEY,
idheader INTEGER NOT NULL REFERENCES invoiceheader ON DELETE CASCADE ON 
UPDATE CASCADE,
 ....
 );

Each invoice must have at leat one row.

I want that transaction commit fails if invoice header is inserted without 
any row in invoice rows table.

How to prevent inserting invoice headers without rows ?

Andrus. 



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to