From: | Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk> |
---|---|
To: | "Jonathan R(dot) Karlen" <jkarlen(at)karlen(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: [GENERAL] ALTER TABLE |
Date: | 1999-08-09 17:29:29 |
Message-ID: | v04020a00b3d4bf066bee@[128.40.242.190] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
To the best of my knowledge, still no way of droping a field directly by
using ALTER.
Usual trick is to do something like:
SELECT <fields>,<you>,<want>,<to>,<keep>
INTO temp_table
FROM <table_you_want_to_alter>;
DROP TABLE <table_you_want_to_alter>;
ALTER TABLE temp_table RENAME TO <table_you_want_to_alter>;
But bear in my that:
- this will not preserve oid's...
- I think things like RULES and TRIGGERS on that table will be affected
(i.e. not work) since these use the table OID and will have to be
regenerated
- constraints, indices, primary keys etc. will be lost and have to be
regenerated
HTH,
Stuart
>Greetings,
>
>Is there a way to drop a field from a table? ALTER TABLE seems to only
>allow the adding and modification of fields.
>
>Thanks.
>
>Jonathan Karlen
>**********************************************************
>Jonathan R. Karlen
>Karlen Internet Solutions
>jkarlen(at)karlen(dot)com
>http://www.karlen.com
+--------------------------+--------------------------------------+
| Stuart C. G. Rison | Ludwig Institute for Cancer Research |
+--------------------------+ 91 Riding House Street |
| N.B. new phone code!! | London, W1P 8BT |
| Tel. +44 (0)207 878 4041 | UNITED KINGDOM |
| Fax. +44 (0)207 878 4040 | stuart(at)ludwig(dot)ucl(dot)ac(dot)uk |
+--------------------------+--------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Hub.Org News Admin | 1999-08-09 18:19:20 | |
Previous Message | Jonathan R. Karlen | 1999-08-09 16:31:51 | ALTER TABLE |