Search Postgresql Archives

Change column type to numeric

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Forgive me if this question has an obvious answer, I'm sorta new to posgresql.

I have a table that's already populated with quite a bit of records.
I'd like to alter a column called "amount" from character varying to
numeric, so I don't have to re-load all of my data sets.

I've already dropped the column default.  When attempting to change
the column type, I get:

test=# alter table foo alter column amount type numeric(10,2) USING
cast(amount AS numeric);
ERROR:  invalid input syntax for type numeric: ""

I'm assuming that it's trying to cast a blank value as numeric and
failing.  Does anyone know of an easy way to work around this?

Thanks!

--Jake

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux