Search Postgresql Archives

alter column to inet get error.

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

 



Hello List,

I want to change some columns in a database
that were originally created as char varying to
inet.

When I try I get an error. Is there anyway to work
around this?

See below for table definition.

                Table "public.kernel_gre"
     Column      |         Type          |   Modifiers
-----------------+-----------------------+---------------
 interface       | character varying(15) | not null
 source_ip       | character varying(16) |
 dest_ip         | character varying(16) |
 physical_ip     | character varying(16) |
 status          | boolean               | default false
 physical_src_ip | character varying(16) |
 tunnel_netmask  | character varying(16) |
 key             | character varying(32) |
 state           | boolean               | default false
 broadcast       | boolean               | default false

alter TABLE kernel_gre ALTER COLUMN  source_ip TYPE inet;
ERROR:  column "source_ip" cannot be cast to type "inet"

current table contents:
 interface | source_ip |  dest_ip  | physical_ip | status | physical_src_ip | tunnel_netmask  | key | state | broadcast
-----------+-----------+-----------+-------------+--------+-----------------+-----------------+-----+-------+-----------
 gre2      | 10.1.1.2  | 10.1.1.1  | 1.1.1.1     | t      | 1.1.1.2         | 255.255.255.255 |     | f     | f
 gre3      | 10.1.1.4  | 10.1.1.3  | 1.1.1.3     | t      | 1.1.1.4         | 255.255.255.255 |     | f     | f
 gre4      | 10.1.1.6  | 10.1.1.5  | 1.1.1.5     | t      | 1.1.1.6         | 255.255.255.255 |     | f     | f
 gre5      | 10.1.1.8  | 10.1.1.7  | 1.1.1.7     | t      | 1.1.1.8         | 255.255.255.255 |     | f     | f
 gre6      | 10.1.1.10 | 10.1.1.9  | 1.1.1.9     | t      | 1.1.1.10        | 255.255.255.255 |     | f     | f
 gre7      | 10.1.1.12 | 10.1.1.11 | 1.1.1.11    | t      | 1.1.1.12        | 255.255.255.255 |     | f     | f
 gre8      | 10.1.1.14 | 10.1.1.13 | 1.1.1.13    | t      | 1.1.1.14        | 255.255.255.255 |     | f     | f
 gre9      | 10.1.1.16 | 10.1.1.15 | 1.1.1.15    | t      | 1.1.1.16        | 255.255.255.255 |     | f     | f
 gre10     | 10.1.1.18 | 10.1.1.17 | 1.1.1.17    | t      | 1.1.1.18        | 255.255.255.255 |     | f     | f
 gre11     | 10.1.1.20 | 10.1.1.19 | 1.1.1.19    | t      | 1.1.1.20        | 255.255.255.255 |     | f     | f
 gre12     | 10.1.1.22 | 10.1.1.21 | 1.1.1.21    | t      | 1.1.1.22        | 255.255.255.255 |     | f     | f
 gre13     | 10.1.1.24 | 10.1.1.23 | 1.1.1.23    | t      | 1.1.1.24        | 255.255.255.255 |     | f     | f
 gre14     | 10.1.1.26 | 10.1.1.25 | 1.1.1.25    | t      | 1.1.1.26        | 255.255.255.255 |     | f     | f
 gre15     | 10.1.1.28 | 10.1.1.27 | 1.1.1.27    | t      | 1.1.1.28        | 255.255.255.255 |     | f     | f
 gre16     | 10.1.1.30 | 10.1.1.29 | 1.1.1.29    | t      | 1.1.1.30        | 255.255.255.255 |     | f     | f
 gre17     | 10.1.1.32 | 10.1.1.31 | 1.1.1.31    | t      | 1.1.1.32        | 255.255.255.255 |     | f     | f
 gre18     | 10.1.1.34 | 10.1.1.33 | 1.1.1.33    | t      | 1.1.1.34        | 255.255.255.255 |     | f     | f
 gre19     | 10.1.1.36 | 10.1.1.35 | 1.1.1.35    | t      | 1.1.1.36        | 255.255.255.255 |     | f     | f
 gre20     | 10.1.1.38 | 10.1.1.37 | 1.1.1.37    | t      | 1.1.1.38        | 255.255.255.255 |     | f     | f
 gre21     | 10.1.1.40 | 10.1.1.39 | 1.1.1.39    | t      | 1.1.1.40        | 255.255.255.255 |     | f     | f
(20 rows)




Thanks in advance,
--
Stephen Clark
NetWolves
Sr. Software Engineer III
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@xxxxxxxxxxxxx
www.netwolves.com

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


[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