Tuesday, July 8, 2008

Re: [GENERAL] Quick way to alter a column type?

On Mon, 2008-07-07 at 02:10 -0400, Lew wrote:
> Ow Mun Heng wrote:
> >> I want to change a column type from varchar(4) to varchar(5) or should I
> >> just use text instead.

> The choice of TEXT for the column would seem to be supported in the PG manual,
> which stresses that TEXT and VARCHAR are quite close in performance, if not
> identical. I recommend to constrain the length if it's proper for the data
> domain. That is, if you are 100% absolutely certifiably certain that the
> length will never change again once you set it to 5, that is, if the data
> domain is a set of values that must be no more than 5 characters long, then
> VARCHAR(5) is a good choice. It accurately represents the data.

It was varchar(4) for a _long_ time until there came a need recently to
move it to a 5 characters.
Hence the issue, I've already changed it to varchar() instead to make it
more open (and less problematic in the future)

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: