Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8C62E47623E for ; Thu, 21 Nov 2002 01:53:23 -0500 (EST) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id A2D2947622E for ; Thu, 21 Nov 2002 01:53:22 -0500 (EST) Received: from 10.192.17.128 ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id gAL6rKvO006226 for ; Thu, 21 Nov 2002 07:53:20 +0100 From: Mario Weilguni To: pgsql-general@postgresql.org Subject: Re: Drop NOT NULL constraint !!! Date: Thu, 21 Nov 2002 07:53:20 +0100 User-Agent: KMail/1.5 References: <20021120114805.C29739-100000@zoraida.natserv.net> <3DDBD5EE.4040804@intransa.com> <20021120170913.74176c82.rene@ibiz.com.br> In-Reply-To: <20021120170913.74176c82.rene@ibiz.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200211210753.20466.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/895 X-Sequence-Number: 33316 Am Mittwoch, 20. November 2002 20:09 schrieb RenX SalomXo: > Does anybody could tell me how to drop a constraint on a column where no > name was provided to the constraint? How does Pg name constraints? > > Thanks did you add a "CHECK" constraint, or did you use "NOT NULL" in the table definition? For the not null case it's easy: update pg_attribute set attnotnull=false where attname='yourattributename' and attrelid=(select oid from pg_class where relname='mytable' and relkind='r'); If you added a check constraint, you have to remove the corresponding row from pg_relcheck and decrement the attribute "relchecks" in pg_class for the table, but I won't do it without having a backup at hand. Backup your data first. Regards, Mario Weilguni