The following bug has been logged online:
Bug reference: 1437
Logged by: Kim Hansen
Email address: k@oek.dk
PostgreSQL version: 8.0.0
Operating system: Windows
Description: converting column from text to int4 requires USING
Details:
When running the input below the 3rd line gives an error but the 4th line
works. I would expect that a::int4 was applyed by default and because of
that the USING shouldn't be nessesary.
== Input ==
CREATE TABLE test ( a text );
INSERT INTO test VALUES ( '1' );
ALTER TABLE test ALTER COLUMN a TYPE int4;
ALTER TABLE test ALTER COLUMN a TYPE int4 USING (a::int4);
DROP TABLE test;
== Output==
public=> \i bug.txt
CREATE TABLE
INSERT 25508 1
psql:bug.txt:3: ERROR: column "a" cannot be cast to type "int4"
ALTER TABLE
DROP TABLE
public=>