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

Re: altering column length

From: Alberto Caso <alberto(dot)caso(at)adaptia(dot)net>
To: Reshat Sabiq <sabiq(at)purdue(dot)edu>
Cc: 'PGSQL Novice List' <pgsql-novice(at)postgresql(dot)org>
Subject: Re: altering column length
Date: 2002-12-29 17:23:35
Message-ID: 1041182615.6921.23.camel@portege1 (view raw or flat)
Thread:
Lists: 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(dot)caso(at)adaptia(dot)net





In response to

Responses

  • innodb at 2002-12-30 09:49:26 from Reshat Sabiq

pgsql-novice by date

Next:From: Reshat SabiqDate: 2002-12-30 09:49:26
Subject: innodb
Previous:From: Alberto CasoDate: 2002-12-29 17:08:27
Subject: Re: sequence generator programmatic invocation(preferably

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