I have a question about using Reference. I have several tables that are
defined such as below
CREATE TABLE iss.accessor (
loaddtlid UUID NOT NULL ,
seqno SMALLINT NOT NULL ,
billable VARCHAR(1) DEFAULT 'N' CHECK(billable IN ('N','Y')) NOT NULL ,
payind VARCHAR(1) DEFAULT 'P' CHECK(payind IN ('P','F')) NOT NULL ,
code UUID REFERENCE accessorcodes (code) ,
description CITEXT ,
ref CITEXT ,
tractororcarrierflag VARCHAR(1) DEFAULT 'T' CHECK(tractororcarrierflag IN
('T','C')) NOT NULL ,
tractororcarriernoid UUID ,
tractorpct DECIMAL(6,4) DEFAULT 0 CHECK(tractorpct BETWEEN 0 AND 1) NOT
NULL ,
charge DECIMAL(7,2) DEFAULT 0 ,
type VARCHAR(1) DEFAULT 'N' CHECK(type IN ('N','V','D','R','A','S')) NOT
NULL ,
checkdate DATE ,
checkno CITEXT ,
processed VARCHAR(1) DEFAULT 'N' CHECK(processed IN ('N','Y')) NOT NULL ,
itemflag VARCHAR(1) DEFAULT 'N' CHECK(itemflag IN ('N','Y')) NOT NULL ,
tractorterminalid UUID REFERENCES terminal (terminalid) ,
cost DECIMAL(7,2) DEFAULT 0 ,
createdatetime TIMESTAMP ,
createuser CITEXT ,
editdatetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
edituser CITEXT DEFAULT CURRENT_USER
)
As you can see there are a few columns which reference back to another
table. What I need to know is how does Postgres work with these columns.
Can I insert or update a row if those columns are null or are they required
to have a non-null value in order for the row to be inserted or saved?
Best Regards
Michael Gould