knowledge-database (beta)

Current group: pgsql.bugs

BUG #1437: converting column from text to int4 requires USING

BUG #1437: converting column from text to int4 requires USING  
Kim Hansen
From:Kim Hansen
Subject:BUG #1437: converting column from text to int4 requires USING
Date:Mon, 24 Jan 2005 00:41:10 GMT

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=>

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
   

Copyright © 2006 knowledge-database   -   All rights reserved