Re: [GENERAL] Alter Column from inet to inet[]

2012-03-14 Thread Tom Lane
Alex -  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

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


[GENERAL] Alter Column from inet to inet[]

2012-03-14 Thread Alex -

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[];
Tried various but no luck. Couldn't find anything in the manuals either.
Can anyone point me in the right direction or tell me what's wrong with my 
statement.
Thanks for any help.
Alex