From: | Michael Gould <mgould(at)intermodalsoftwaresolutions(dot)net> |
---|---|
To: | Postgres General Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | DDL with Reference on them. |
Date: | 2009-09-21 19:56:35 |
Message-ID: | 6164324f1fba183171c554012fc1ab85@intermodalsoftwaresolutions.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Scot Kreienkamp | 2009-09-21 20:03:34 | Re: VMWare file system / database corruption |
Previous Message | Mark Felegyhazi | 2009-09-21 19:33:44 | Insert unique fails, still increments ID in a lookup table |