But on postgreSQL 7.2 reference manual, there is a statement for alter table
such as, ALTER TABLE [ ONLY ] table [ * ] ALTER [ COLUMN ] column { SET | DROP } NOT NULL
Do you mean this one hasn't been implemented?
Jack
----- Original Message -----
From: "Tomasz Myrta" <jasiek@klaster.net>
To: "jack" <datactrl@tpg.com.au>
Cc: <pgsql-sql@postgresql.org>
Sent: Tuesday, January 07, 2003 11:31 PM
Subject: Re: [SQL] A problem about alter table
> jack wrote:
>
> > Hi, all
> > I'm using postgreSQL 7.2.3. The following statement always cuases a
parser
> > error, "parse error at or near NOT". Please adivse, thank you in
advance.
> >
> > ALTER TABLE _acct_group1
> > ALTER groupkey SET NOT NULL;
> >
> > Jack
> >
> From Postgres 7.2 documentation:
>
> "In the current implementation of ADD COLUMN, default and NOT NULL
> clauses for the new column are not supported. You can use the SET
> DEFAULT form of ALTER TABLE to set the default later. (You may also want
> to update the already existing rows to the new default value, using
> UPDATE.)"
>
> There is nothing about setting not null fields.
> I think you have to create trigger instead of altering table.
>
> Regards,
> Tomasz Myrta
>