Re: altering column length - Mailing list pgsql-novice

From Alberto Caso
Subject Re: altering column length
Date
Msg-id 1041182615.6921.23.camel@portege1
Whole thread Raw
In response to altering column length  ("Reshat Sabiq" <sabiq@purdue.edu>)
Responses innodb
List pgsql-novice
El dom, 29-12-2002 a las 14:35, Reshat Sabiq escribió:
> I believe it is not possible yet in postreSQL, but in case it is what
> would be the equivalent of the following Oracle statement (assuming
> current myfield size to be 10 bytes (of type char)):
> ALTER TABLE mytable MODIFY (myfield CHAR(12));
>
> If it's currently not supported is there a way to submit an RFE?

    It's not supported. You can instead create a new table with the field
already as you want it to be, and transfer data, as explained in [1].

    Another possible way, if you are using PostgreSQL 7.3, it already
supports dropping columns so you can create a new column myfield_temp as
char(12), copy values from myfield, drop myfield and rename myfield_temp
to myfield. You should keep in mind that default and NOT NULL are not
supported in ADD COLUMN and you should use SET DEFAULT or SET NOT NULL
aftewards as required.

[1] http://techdocs.postgresql.org/techdocs/updatingcolumns.php

    Regards,
--
Alberto Caso Palomino
Adaptia Soluciones Integrales
http://www.adaptia.net
alberto.caso@adaptia.net





pgsql-novice by date:

Previous
From: Alberto Caso
Date:
Subject: Re: sequence generator programmatic invocation(preferably
Next
From: "Reshat Sabiq"
Date:
Subject: innodb