Search Postgresql Archives

Re: alter column to inet get error.

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

 



On Fri, Sep 3, 2010 at 7:21 AM, Steve Clark <sclark@xxxxxxxxxxxxx> wrote:
> 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"
>

Try

alter TABLE kernel_gre ALTER COLUMN  source_ip TYPE inet using source_ip::inet
-- 
To understand recursion, one must first understand recursion.

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