Re: Removing all NOT NULL constraints from multiple tables easily

From: "Darrin Ladd" <darrin_ladd(at)hotmail(dot)com>
To: danb(at)cyclonecomputers(dot)com, pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: Removing all NOT NULL constraints from multiple tables easily
Date: 2000-09-11 13:57:22
Message-ID: F282044cY6PONBCiDtU00009214@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

As far as I have been able to find (and I *could* be wrong) the only way to
remove a not null constraint (without drop/create) is to directly update the
pg_attribute.attnotnull field for the row. It is a boolean field so
updating it to 'false' does the trick. I hope this helps (and is the
correct way to do it, since this is what I have been doing!).

Darrin

>From: "Dan Browning" <danb(at)cyclonecomputers(dot)com>
>To: <pgsql-general(at)postgresql(dot)org>, <pgsql-novice(at)postgresql(dot)org>
>Subject: [GENERAL] Removing all NOT NULL constraints from multiple tables
>easily
>Date: Mon, 11 Sep 2000 06:32:27 -0700
>
>I would like to remove all NOT NULL constraints from my tables.
>
>I've tried ALTER TABLE, but I can't seem to get the syntax right, and the
>docs aren't clear to me.
>What is the correct syntax? If there's another way, short of manually
>recreating (dump, create, import) the tables, I'd love to hear it.
>
>Thanks,
>
>Dan Browning
>Network & Database Administrator
>Cyclone Computer Systems
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

Browse pgsql-general by date

  From Date Subject
Next Message Adam Lang 2000-09-11 14:03:33 Re: PostgreSQL + PHP can't connect
Previous Message Andreas Jerke 2000-09-11 13:46:26 AW: can't read SQL dump from MySQL