ALTER TABLE commands

Поиск
Список
Период
Сортировка
Искать

ALTER TABLE commands

От:
Tariq Muhammad <tmuhamma@libertyrms.com>
Дата:


Hello

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


I am running postgressql version is 7.1.3 under solaris.

Your help would be much appreciated.

Thanks

Tariq Muhammad
L i b e r t y   R M S
http://www.libertyrms.com
tmuhamma@libertyrms.com



Re: ALTER TABLE commands

От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:

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');

FAQ