Change column type macaddr to macaddr[]

Started by Ertan Küçükoğluover 8 years ago3 messagesgeneral
Jump to latest
#1Ertan Küçükoğlu
ertan.kucukoglu@1nar.com.tr

Hello,

I am using PostgreSQL 9.6.6 on armv8l-unknown-linux-gnueabihf, compiled by
gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516, 32-bit

I have a table with column name mac type macaddr. I need to change it into
array of macaddr ( macaddr[] ) type. Among all others I did try below:

licenses=# alter table licreqm alter column mac type macaddr[] using
mac::macaddr[];
ERROR: cannot cast type macaddr to macaddr[]
LINE 1: ... licreqm alter column mac type macaddr[] using mac::macaddr[...
^
I believe there should be a way, I just do not know it myself. Anyone can
help me?

Thanks & regards,
Ertan Küçükoğlu

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Ertan Küçükoğlu (#1)
Re: Change column type macaddr to macaddr[]

On Saturday, December 30, 2017, Ertan Küçükoğlu <ertan.kucukoglu@1nar.com.tr>
wrote:

Hello,

I am using PostgreSQL 9.6.6 on armv8l-unknown-linux-gnueabihf, compiled by
gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516, 32-bit

I have a table with column name mac type macaddr. I need to change it into
array of macaddr ( macaddr[] ) type. Among all others I did try below:

licenses=# alter table licreqm alter column mac type macaddr[] using
mac::macaddr[];
ERROR: cannot cast type macaddr to macaddr[]
LINE 1: ... licreqm alter column mac type macaddr[] using mac::macaddr[...
^
I believe there should be a way, I just do not know it myself. Anyone can
help me?

Maybe try:

Using array[mac]::macaddr[]

David J.

#3Ertan Küçükoğlu
ertan.kucukoglu@1nar.com.tr
In reply to: David G. Johnston (#2)
RE: Change column type macaddr to macaddr[]

From: David G. Johnston [mailto:david.g.johnston@gmail.com]
Sent: Sunday, December 31, 2017 2:56 AM
To: Ertan Küçükoğlu <ertan.kucukoglu@1nar.com.tr>
Cc: pgsql-general@postgresql.org
Subject: Re: Change column type macaddr to macaddr[]

Maybe try:

Using array[mac]::macaddr[]

David J.

Yes, that did the job.

Thank you.