Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 510DE4759BD for ; Tue, 7 Jan 2003 09:06:24 -0500 (EST) Received: from mail1.tpgi.com.au (mail.tpgi.com.au [203.12.160.57]) by postgresql.org (Postfix) with ESMTP id 24D5B4758C9 for ; Tue, 7 Jan 2003 09:06:23 -0500 (EST) Received: from jac (bri-ts3-2600-139.tpgi.com.au [203.219.26.139]) by mail1.tpgi.com.au (8.11.6/8.11.6) with SMTP id h07E6Od10329 for ; Wed, 8 Jan 2003 01:06:25 +1100 Message-ID: <001101c2b655$f4a03290$1400a8c0@jac> From: "jack" To: References: <001601c2b64b$ba8c3b30$1400a8c0@jac> <3E1AD6AA.3080406@klaster.net> Subject: Re: A problem about alter table Date: Wed, 8 Jan 2003 00:06:19 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/59 X-Sequence-Number: 10924 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" To: "jack" Cc: 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 >