On 12/30/2016 06:38 AM, Rich Shepard wrote: > Reading the 9.6 docs suggests an answer to my question, but does not > explicitly answer it, so I ask here. > > If a column has a default value specified does this mean the column > cannot > contain a NULL value? In other words, is DEFAULT <some_value> NOT NULL > redundant? Another way of looking at it: test=> create table default_test_2(id int, fld_1 varchar DEFAULT 'test'); CREATE TABLE test=> insert into default_test_2 values (1); INSERT 0 1 test=> insert into default_test_2 values (2, NULL); INSERT 0 1 test=> \pset null 'NULL' test=> select * from default_test_2 ; id | fld_1 ----+------- 1 | test 2 | NULL (2 rows) DEFAULT is what is the column is set to if the user does not specify a value. As shown above a user can supply a NULL value. To guard against that the NOT NULL constraint is required. > > TIA, > > Rich > > -- Adrian Klaver adrian.klaver@xxxxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general