pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: not null
4+ messages / 3 participants
[nested] [flat]
* not null
@ 2003-01-25 11:52 ryanne cruz <ryanne.cruz@up.edu.ph>
2003-01-25 11:51 ` Re: not null Philipp Ottlinger <ottlinger@computer-systeme.de>
2003-01-25 12:55 ` Re: not null Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-25 12:59 ` Re: not null Matthew Horoschun <mhoroschun@canprint.com.au>
0 siblings, 3 replies; 4+ messages in thread
From: ryanne cruz @ 2003-01-25 11:52 UTC (permalink / raw)
To: pgsql-php
hi list.
i have a column that has a "not null" as its modifier. is there a way that i
can remove that? or better yet to make it a "serial not null"?
thanks!
ryanne
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: not null
2003-01-25 11:52 not null ryanne cruz <ryanne.cruz@up.edu.ph>
@ 2003-01-25 11:51 ` Philipp Ottlinger <ottlinger@computer-systeme.de>
2 siblings, 0 replies; 4+ messages in thread
From: Philipp Ottlinger @ 2003-01-25 11:51 UTC (permalink / raw)
To: ryanne cruz <ryanne.cruz@up.edu.ph>; +Cc: pgsql-php
ryanne cruz wrote:
>
> hi list.
>
> i have a column that has a "not null" as its modifier. is there a way that i
> can remove that? or better yet to make it a "serial not null"?
>
It depends on your entitiy-relationship schema - usually it makes sense
to define things as "not null" and it shouldn't be considered to be
taken away just by chance !!!
Usually you can alter the TABLE to remove such constraints ...
SERIAL - if I'm not too mistaken - is automatically maintained by
postgres as an implicit sequence whose values are generated by calling
sequence.nextval autonomously everytime you "need" a value!
Yours,
Phil
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: not null
2003-01-25 11:52 not null ryanne cruz <ryanne.cruz@up.edu.ph>
@ 2003-01-25 12:55 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Horoschun @ 2003-01-25 12:55 UTC (permalink / raw)
To: ryanne cruz <ryanne.cruz@up.edu.ph>; +Cc: pgsql-php
Hi Ryanne,
As already suggested, a SERIAL is just an column that has a default of
the nextval() of an implicitly defined SEQUENCE.
So, try:
ALTER TABLE table_name ALTER COLUMN column_name SET DEFAULT
nextval('column_name_seq'::text);
CREATE SEQUENCE column_name_seq;
Cheers
Matthew.
On Saturday, January 25, 2003, at 10:52 PM, ryanne cruz wrote:
>
> hi list.
>
> i have a column that has a "not null" as its modifier. is there a way
> that i
> can remove that? or better yet to make it a "serial not null"?
--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.
--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.
Mobile: 0417 282 378
Direct: (02) 6295 4544
Telephone: (02) 6295 4422
Facsimile: (02) 6295 4473
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: not null
2003-01-25 11:52 not null ryanne cruz <ryanne.cruz@up.edu.ph>
@ 2003-01-25 12:59 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Horoschun @ 2003-01-25 12:59 UTC (permalink / raw)
To: ryanne cruz <ryanne.cruz@up.edu.ph>; +Cc: pgsql-php
Hi Ryanne,
As already suggested, a SERIAL is just an column that has a default of
the nextval() of an implicitly defined SEQUENCE.
So, try:
ALTER TABLE table_name ALTER COLUMN column_name SET DEFAULT
nextval('column_name_seq'::text);
CREATE SEQUENCE column_name_seq;
Cheers
Matthew.
On Saturday, January 25, 2003, at 10:52 PM, ryanne cruz wrote:
>
> hi list.
>
> i have a column that has a "not null" as its modifier. is there a way
> that i
> can remove that? or better yet to make it a "serial not null"?
--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.
--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.
Mobile: 0417 282 378
Direct: (02) 6295 4544
Telephone: (02) 6295 4422
Facsimile: (02) 6295 4473
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-01-25 12:59 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-25 11:52 not null ryanne cruz <ryanne.cruz@up.edu.ph>
2003-01-25 11:51 ` Philipp Ottlinger <ottlinger@computer-systeme.de>
2003-01-25 12:55 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-25 12:59 ` Matthew Horoschun <mhoroschun@canprint.com.au>
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