pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
weird result by changing type enum array to text array of a column
3+ messages / 2 participants
[nested] [flat]

* weird result by changing type enum array to text array of a column
@ 2018-02-05 10:26  Thomas Poty <thomas.poty@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Poty @ 2018-02-05 10:26 UTC (permalink / raw)
  To: pgsql-general

Hello,

I m running 9.5.10 on centos 7.

I have a colmun "TestFields", its type is an array of an enum.

I would like to change the type of this column by an array of text.

So i execute  -> alter table "controldetailpromoters" alter column
"TestFields" type text[]
The command seems to be correctly executed
 but  when I execute a "\d" of my table, the column "TestFields" is always
an array of the enum....


Do you have any idea of what is going wrong?

Thank you.
Thomas

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: weird result by changing type enum array to text array of a column
@ 2018-02-05 12:16  rob stone <floriparob@gmail.com>
  parent: Thomas Poty <thomas.poty@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: rob stone @ 2018-02-05 12:16 UTC (permalink / raw)
  To: Thomas Poty <thomas.poty@gmail.com>; pgsql-general



On Mon, 2018-02-05 at 11:26 +0100, Thomas Poty wrote:
> Hello,
> 
> I m running 9.5.10 on centos 7.
> 
> I have a colmun "TestFields", its type is an array of an enum.
> 
> I would like to change the type of this column by an array of text.
> 
> So i execute  -> alter table "controldetailpromoters" alter column
> "TestFields" type text[]
> The command seems to be correctly executed
>  but  when I execute a "\d" of my table, the column "TestFields" is
> always an array of the enum....
> 
> 
> Do you have any idea of what is going wrong?
> 
> Thank you.
> Thomas


Hello Thomas,

See chapter 8.7.

Your array "TestFields" contains the internal enum references that are
converted to the defined values by cross referencing to the catalogue
table pg_enum.
I think you will have to add another column to the table as an array of
text, write a little program to cross reference the TestFields array to
pg_enum and update the new column with the textual representation of
the "enum's", then alter your app accordingly.

HTH,
Rob




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: weird result by changing type enum array to text array of a column
@ 2018-02-05 13:09  Thomas Poty <thomas.poty@gmail.com>
  parent: rob stone <floriparob@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Poty @ 2018-02-05 13:09 UTC (permalink / raw)
  To: rob stone <floriparob@gmail.com>; +Cc: pgsql-general

Hello Rob,

I already read this.

I have already executed  this kind of procedure except with an array.

I don't know why but now it is working :-s

Thank you for your reply :-)

Thomas


2018-02-05 13:16 GMT+01:00 rob stone <floriparob@gmail.com>:

>
>
> On Mon, 2018-02-05 at 11:26 +0100, Thomas Poty wrote:
> > Hello,
> >
> > I m running 9.5.10 on centos 7.
> >
> > I have a colmun "TestFields", its type is an array of an enum.
> >
> > I would like to change the type of this column by an array of text.
> >
> > So i execute  -> alter table "controldetailpromoters" alter column
> > "TestFields" type text[]
> > The command seems to be correctly executed
> >  but  when I execute a "\d" of my table, the column "TestFields" is
> > always an array of the enum....
> >
> >
> > Do you have any idea of what is going wrong?
> >
> > Thank you.
> > Thomas
>
>
> Hello Thomas,
>
> See chapter 8.7.
>
> Your array "TestFields" contains the internal enum references that are
> converted to the defined values by cross referencing to the catalogue
> table pg_enum.
> I think you will have to add another column to the table as an array of
> text, write a little program to cross reference the TestFields array to
> pg_enum and update the new column with the textual representation of
> the "enum's", then alter your app accordingly.
>
> HTH,
> Rob
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-02-05 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 10:26 weird result by changing type enum array to text array of a column Thomas Poty <thomas.poty@gmail.com>
2018-02-05 12:16 ` rob stone <floriparob@gmail.com>
2018-02-05 13:09   ` Thomas Poty <thomas.poty@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox