Re: Not null contraints - Mailing list pgsql-general

From Tom Lane
Subject Re: Not null contraints
Date
Msg-id 1668.971497592@sss.pgh.pa.us
Whole thread Raw
In response to Not null contraints  ("Tamsin" <tg_mail@bryncadfan.co.uk>)
Responses Re: Not null contraints  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-general
"Tamsin" <tg_mail@bryncadfan.co.uk> writes:
> I want to remove a not null constraint from a table.  I've read the posts
> about having to rename, recreate without not nulls & insert back into the
> table.  This is fine, but the table also has a lot of foreign keys/rules etc
> & recreating all these is a bit of pain.
> I tried updating pg_attribute & setting attnotnull to 'f' for the field in
> question.  This seems to have worked.  Is it safe?! - is there anything else
> I should be aware of?

Yup, that should do the trick.  Not much magic here...

            regards, tom lane

pgsql-general by date:

Previous
From: "Dominic J. Eidson"
Date:
Subject: Re: Question about pg_dump
Next
From: The Hermit Hacker
Date:
Subject: RE: Matlab Mex Interface