Skip site navigation (1) Skip section navigation (2)

Alter table .. Add primary key

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Alter table .. Add primary key
Date: 2002-11-28 16:06:25
Message-ID: 1038499584.54963.4.camel@jester (view raw or whole thread)
Lists: pgsql-hackers
When doing an alter table .. add primary key operation on columns which
are not marked as null, would it be appropriate to mark the primary key
columns not null?

This follows with create table auto-marking columns null for primary

rbt=# \d ar
     Table ""
 Column | Type | Modifiers 
 col    | r    | 

rbt=# alter table ar add primary key (col);
ERROR:  Existing attribute "col" cannot be a PRIMARY KEY because it is
not marked NOT NULL

Rod Taylor <rbt(at)rbt(dot)ca>

pgsql-hackers by date

Next:From: Steve JacksonDate: 2002-11-28 16:12:30
Subject: record object type
Previous:From: Tom LaneDate: 2002-11-28 15:45:39
Subject: Re: Auto Vacuum Daemon (again...)

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group