Re: Alter Column from inet to inet[]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alex - <aintokyo(at)hotmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Alter Column from inet to inet[]
Date: 2012-03-14 16:16:58
Message-ID: 1779.1331741818@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alex - <aintokyo(at)hotmail(dot)com> writes:
> Hi,I need to change a column type from inet to inet[] but the alter command always gives me the following errors
> ERROR: column "access_ip" cannot be cast to type inet[]
> ALTER TABLE users ALTER COLUMN access_ip SET DATA TYPE inet[] USING access_ip::inet[];

The problem is precisely that the system lacks a cast from inet to inet[].
Telling it to apply a cast it hasn't got doesn't help. What you need to
do is show how to construct the new column values. Try something like
USING ARRAY[access_ip]

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message François Beausoleil 2012-03-14 17:38:53 Re: COPY and indices?
Previous Message Alex - 2012-03-14 16:05:42 Alter Column from inet to inet[]