Re: [GENERAL] Default column value - Mailing list pgsql-general

From Rich Shepard
Subject Re: [GENERAL] Default column value
Date
Msg-id alpine.LNX.2.11.1612300815330.11546@localhost
Whole thread Raw
In response to Re: [GENERAL] Default column value  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: [GENERAL] Default column value
List pgsql-general
On Fri, 30 Dec 2016, Adrian Klaver wrote:

> 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.

   One more case I'd appreciate being clarified: when the column's value has
a check constraint with acceptable values in a list. For example,

param_units VARCHAR(8) DEFAULT 'mg/L'
     CONSTRAINT param_units
       CHECK (param_units IN ('ppm', 'mg/L', 'ug/L', 'umho/cm', 'percent', 'cfm', 'gpm')),

   Seems to me that if values are constrained by a list a NULL cannot be
entered by the user. Is this correct?

Rich


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: [GENERAL] LYDB: Feasible to use PG roles instead ofapplication-level security?
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Default column value