pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
removing "not null" modifier
3+ messages / 3 participants
[nested] [flat]

* removing "not null" modifier
@ 2006-03-13 13:07 Robert Urban <urban@UNIX-Beratung.de>
  2006-03-13 15:04 ` Re: removing "not null" modifier Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Robert Urban @ 2006-03-13 13:07 UTC (permalink / raw)
  To: pgsql-sql

Hello,

let's say I have created a postgresql-7.2.2 db using the following cmds:

	CREATE TABLE status
	(
		id SERIAL NOT NULL PRIMARY KEY,
		name VARCHAR(32)
	);

	CREATE TABLE event
	(
		id SERIAL NOT NULL PRIMARY KEY,
		description VARCHAR(32),
		status_id  INTEGER NOT NULL REFERENCES status(id)
	);

in psql I then see:

mydb=# \d event
                                     Table "event"
   Column    |         Type          |                    Modifiers                     
-------------+-----------------------+--------------------------------------------------
 id          | integer               | not null default nextval('"event_id_seq"'::text)
 description | character varying(32) | 
 status_id   | integer               | not null
Primary key: event_pkey
Triggers: RI_ConstraintTrigger_43210


The question:

how can I get rid of the "not null" modifier on status_id?  

thanks,

Robert Urban



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: removing "not null" modifier
  2006-03-13 13:07 removing "not null" modifier Robert Urban <urban@UNIX-Beratung.de>
@ 2006-03-13 15:04 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2006-03-13 15:47   ` Re: removing "not null" modifier Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Achilleus Mantzios @ 2006-03-13 15:04 UTC (permalink / raw)
  To: Robert Urban <urban@UNIX-Beratung.de>; +Cc: pgsql-sql

O Robert Urban Ýãñáøå óôéò Mar 13, 2006 :

> Hello,
> 
> let's say I have created a postgresql-7.2.2 db using the following cmds:
> 
> 	CREATE TABLE status
> 	(
> 		id SERIAL NOT NULL PRIMARY KEY,
> 		name VARCHAR(32)
> 	);
> 
> 	CREATE TABLE event
> 	(
> 		id SERIAL NOT NULL PRIMARY KEY,
> 		description VARCHAR(32),
> 		status_id  INTEGER NOT NULL REFERENCES status(id)
> 	);
> 
> in psql I then see:
> 
> mydb=# \d event
>                                      Table "event"
>    Column    |         Type          |                    Modifiers                     
> -------------+-----------------------+--------------------------------------------------
>  id          | integer               | not null default nextval('"event_id_seq"'::text)
>  description | character varying(32) | 
>  status_id   | integer               | not null
> Primary key: event_pkey
> Triggers: RI_ConstraintTrigger_43210
> 
> 
> The question:
> 
> how can I get rid of the "not null" modifier on status_id?  

ALTER TABLE event ALTER status_id DROP NOT NULL;


> 
> thanks,
> 
> Robert Urban
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: removing "not null" modifier
  2006-03-13 13:07 removing "not null" modifier Robert Urban <urban@UNIX-Beratung.de>
  2006-03-13 15:04 ` Re: removing "not null" modifier Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2006-03-13 15:47   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2006-03-13 15:47 UTC (permalink / raw)
  To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: Robert Urban <urban@UNIX-Beratung.de>; pgsql-sql

Achilleus Mantzios <achill@matrix.gatewaynet.com> writes:
> O Robert Urban Ýãñáøå óôéò Mar 13, 2006 :
>> how can I get rid of the "not null" modifier on status_id?  

> ALTER TABLE event ALTER status_id DROP NOT NULL;

I don't think 7.2 has that.  Of course, there are many excellent reasons
why Robert needs to get himself off 7.2.2 ASAP.  Some of them can be
found here:
http://developer.postgresql.org/docs/postgres/release.html

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-03-13 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13 13:07 removing "not null" modifier Robert Urban <urban@UNIX-Beratung.de>
2006-03-13 15:04 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2006-03-13 15:47   ` Tom Lane <tgl@sss.pgh.pa.us>

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