From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bob Smith <bsmith@h-e.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Changing NOT NULL condition on column
Date: Tue, 20 May 2003 23:58:44 -0400
Message-ID: <4588.1053489524@sss.pgh.pa.us> (raw)
In-Reply-To: <734BFEFD-8B1C-11D7-AAB1-0003933DD370@h-e.com>
References: <734BFEFD-8B1C-11D7-AAB1-0003933DD370@h-e.com>
Bob Smith <bsmith@h-e.com> writes:
> I need to change the not-null restriction on some columns in a table,
> and this doesn't seem to be possible with ALTER TABLE. Is it safe to
> connect as superuser and update pg_attribute.attnotnull directly?
Yeah. I am not certain offhand that currently-running backends would
notice such a change, but at worst starting new sessions would cause
them to honor it.
> I'm currently running 7.2.3, but will be upgrading soon so I'd like to
> know if this would work with 7.3 as well.
In 7.3 there are ALTER TABLE variants to handle this more cleanly.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, bsmith@h-e.com
Subject: Re: Changing NOT NULL condition on column
In-Reply-To: <4588.1053489524@sss.pgh.pa.us>
References: <734BFEFD-8B1C-11D7-AAB1-0003933DD370@h-e.com> <4588.1053489524@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox