X-Original-To: pgsql-admin@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 2121E92534F for ; Wed, 21 May 2003 00:00:39 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 60238-05 for ; Wed, 21 May 2003 00:00:07 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 6D5EE925341 for ; Wed, 21 May 2003 00:00:06 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4L3wiU6004589; Tue, 20 May 2003 23:58:44 -0400 (EDT) To: Bob Smith Cc: pgsql-admin Subject: Re: Changing NOT NULL condition on column In-reply-to: <734BFEFD-8B1C-11D7-AAB1-0003933DD370@h-e.com> References: <734BFEFD-8B1C-11D7-AAB1-0003933DD370@h-e.com> Comments: In-reply-to Bob Smith message dated "Tue, 20 May 2003 16:40:34 -0700" Date: Tue, 20 May 2003 23:58:44 -0400 Message-ID: <4588.1053489524@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/271 X-Sequence-Number: 8833 Bob Smith 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