| From: | Andreas Seltenreich <seltenreich(at)gmx(dot)de> |
|---|---|
| To: | "Daniel Seichter" <dseichter(at)radiomatic(dot)com> |
| Cc: | <pgsql-de-allgemein(at)postgresql(dot)org> |
| Subject: | Re: ALTER TABLE pc ALTER COLUMN code SET UNIQUE |
| Date: | 2005-04-13 13:24:34 |
| Message-ID: | 878y3mvmgd.fsf@gate450.dyndns.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-de-allgemein |
Daniel Seichter writes:
> ALTER TABLE pc ALTER COLUMN code SET UNIQUE;
> geht es nicht. Ich kann aber SET NOT NULL machen, d.h. syntaktisch
> scheint alles richtig zu sein.
Sicher? Ich sehe hier kein SET UNIQUE:
--8<---------------cut here---------------start------------->8---
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] spalte { SET DEFAULT ausdruck | DROP DEFAULT }
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] spalte { SET | DROP } NOT NULL
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] spalte SET STATISTICS integer
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] spalte SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
--8<---------------cut here---------------end--------------->8---
> Aber wie kann ich das Feld "code" auf
> UNIQUE setzen?
--8<---------------cut here---------------start------------->8---
ALTER TABLE [ ONLY ] name [ * ]
ADD tabellen_constraint
--8<---------------cut here---------------end--------------->8---
ALTER TABLE pc add constraint code_unique unique(code);
HTH
Andreas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Markus Bertheau ☭ | 2005-04-13 13:25:52 | Re: ALTER TABLE pc ALTER COLUMN code SET |
| Previous Message | Andreas Kretschmer | 2005-04-13 13:21:35 | Re: [despammed] ALTER TABLE pc ALTER COLUMN code SET UNIQUE |