Re: ALTER TABLE commands

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tariq Muhammad <tmuhamma(at)libertyrms(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: ALTER TABLE commands
Date: 2001-10-17 04:45:26
Message-ID: Pine.BSF.4.21.0110162142210.20084-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


On Tue, 16 Oct 2001, Tariq Muhammad wrote:

> I am trying to set value of an attribute to not null but it does not work
> I am using the following statment:
>
> UPDATE contact
> SET attnotnull = TRUE
> WHERE attname = '_rserv_ts' ;
>
> The error I get is as under :
>
> ERROR: Attribute 'attname' not found

You need to update pg_attribute, something like:
update pg_attribute
set attnotnull=true
where attname='_rserv_ts' and
exists (select * from pg_class where
pg_class.oid=pg_attribute.oid and
pg_class.relname='contact');

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Moovarkku Mudhalvan 2001-10-17 06:33:40 Convertion of Oracle Database to Postgresql
Previous Message Tom Lane 2001-10-17 04:14:06 Re: Database subdirectories in V7.1.x