Re: Alter Column from inet to inet[] - Mailing list pgsql-general

From Tom Lane
Subject Re: Alter Column from inet to inet[]
Date
Msg-id 1779.1331741818@sss.pgh.pa.us
Whole thread Raw
In response to Alter Column from inet to inet[]  (Alex - <aintokyo@hotmail.com>)
List pgsql-general
Alex - <aintokyo@hotmail.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

pgsql-general by date:

Previous
From: Alex -
Date:
Subject: Alter Column from inet to inet[]
Next
From: François Beausoleil
Date:
Subject: Re: COPY and indices?