pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedA problem about alter table
6+ messages / 4 participants
[nested] [flat]
* A problem about alter table
@ 2003-01-07 12:53 jack <datactrl@tpg.com.au>
0 siblings, 2 replies; 6+ messages in thread
From: jack @ 2003-01-07 12:53 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem about alter table
@ 2003-01-07 13:31 Tomasz Myrta <jasiek@klaster.net>
parent: jack <datactrl@tpg.com.au>
1 sibling, 1 reply; 6+ messages in thread
From: Tomasz Myrta @ 2003-01-07 13:31 UTC (permalink / raw)
To: jack <datactrl@tpg.com.au>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem about alter table
@ 2003-01-07 14:06 jack <datactrl@tpg.com.au>
parent: Tomasz Myrta <jasiek@klaster.net>
0 siblings, 2 replies; 6+ messages in thread
From: jack @ 2003-01-07 14:06 UTC (permalink / raw)
To: pgsql-sql
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
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem about alter table
@ 2003-01-07 14:29 Tomasz Myrta <jasiek@klaster.net>
parent: jack <datactrl@tpg.com.au>
1 sibling, 0 replies; 6+ messages in thread
From: Tomasz Myrta @ 2003-01-07 14:29 UTC (permalink / raw)
To: jack <datactrl@tpg.com.au>; +Cc: pgsql-sql
jack wrote:
> 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
>
Strange. I don't have such ALTER TABLE in my 7.2 documentation. There is
only ALTER... SET | DROP DEFAULT.
Tomasz
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem about alter table
@ 2003-01-07 15:07 Jeff Eckermann <jeff_eckermann@yahoo.com>
parent: jack <datactrl@tpg.com.au>
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Eckermann @ 2003-01-07 15:07 UTC (permalink / raw)
To: jack <datactrl@tpg.com.au>; pgsql-sql
--- jack <datactrl@tpg.com.au> 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;
I believe you will need to use:
ALTER TABLE _acct_group1 ADD CONSTRAINT <constraint
name> CHECK groupkey NOT NULL;
I haven't checked that syntax for correctness, but
it's covered in the docs on ALTER TABLE.
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem about alter table
@ 2003-01-07 18:41 Achilleus Mantzios <achill@matrix.gatewaynet.com>
parent: jack <datactrl@tpg.com.au>
1 sibling, 0 replies; 6+ messages in thread
From: Achilleus Mantzios @ 2003-01-07 18:41 UTC (permalink / raw)
To: jack <datactrl@tpg.com.au>; +Cc: pgsql-sql
On Wed, 8 Jan 2003, jack wrote:
> 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
This syntax is valid in 7.3 (not 7.2)
>
> ----- 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
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2003-01-07 18:41 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 12:53 A problem about alter table jack <datactrl@tpg.com.au>
2003-01-07 13:31 ` Tomasz Myrta <jasiek@klaster.net>
2003-01-07 14:06 ` jack <datactrl@tpg.com.au>
2003-01-07 14:29 ` Tomasz Myrta <jasiek@klaster.net>
2003-01-07 18:41 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-01-07 15:07 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox