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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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
keys.

rbt=# \d ar
Table "public.ar"
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>

Browse pgsql-hackers by date

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