Re: Changing from NOT NULL to NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rob Mosher <mosher(at)andrews(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Changing from NOT NULL to NULL
Date: 2004-02-15 23:08:27
Message-ID: 16118.1076886507@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Rob Mosher <mosher(at)andrews(dot)edu> writes:
> Is there anyway I can change a field to allowing nulls without dumping
> the table, dropping it, recreating it as desired, and filling all the
> data back in?

ALTER TABLE ... DROP NOT NULL does the trick in recent releases. Before
that, you could resort to manually poking the attnotnull flag in
the pg_attribute row for the field.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2004-02-15 23:20:54 Re: Changing from NOT NULL to NULL
Previous Message Rob Mosher 2004-02-15 19:57:35 Changing from NOT NULL to NULL