Search Postgresql Archives

DDL with Reference on them.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux