Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eifmY-0004nT-GV for pgsql-general@arkaria.postgresql.org; Mon, 05 Feb 2018 12:21:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eifmW-0004HS-UI for pgsql-general@arkaria.postgresql.org; Mon, 05 Feb 2018 12:21:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eifmW-0004GI-DZ for pgsql-general@lists.postgresql.org; Mon, 05 Feb 2018 12:21:56 +0000 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eifmS-0003By-NV for pgsql-general@postgresql.org; Mon, 05 Feb 2018 12:21:55 +0000 Received: by mail-pg0-x231.google.com with SMTP id x25so5748304pge.3 for ; Mon, 05 Feb 2018 04:21:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:in-reply-to:references:date:mime-version :content-transfer-encoding; bh=mFqZyHdlrj8Zb9Tn2o5wZ2nyxtw9ft8BVIEK2F3WO2Q=; b=jNnIRv3MjQyzOWFIvQHWE4h0fwJB3bVeGM1xV8Xo+0jg64QEeBgLuhSOysxu5fDB3p 7jaiHLj1gkGgZzZ9FO9dRYzykM8rYjW5bRxD+lJO3VXsXpWdefRYyHH/+jky7Z2hgA/p 8xJtnqu76jiQUCjcO7neZ6stErsG/M2444b8q12tIfR4I4pTqp1rXS2D2tT+PJhiwVIV 1qVfHnUI3X2myuZz/uPxYIc0Y4HqbnhjhnjSzQKAf6HK6Ee+OB4kfVIUpfUILV5qNZ+o 2X8PMDm3FJ64u1NKqFVnWaQey1BXDEIHCcLv72A87tHEkW4dzRAt8cfJwxMJExlL/Jbf /s6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:in-reply-to :references:date:mime-version:content-transfer-encoding; bh=mFqZyHdlrj8Zb9Tn2o5wZ2nyxtw9ft8BVIEK2F3WO2Q=; b=OgaDRsqWbtHRR6BQ8HAL3FqNUSG6L1N8r6U8K60IhOhVZ+X8x+L5oRhj6TyGVKAo12 WvSF3NV1gGvt6s51E0VG2qlGsNWvM9UtB95qLH3iK7t0/01wrUssObyZi0I11V6jWoXw BaoHAMfC6nilGYVpj+hkzdFEpa4vWCdD4DEfOfUlY0kpn/zQlybLrGXlkF7nK7ANjCmf ADNyUNSBQ8nsfoW+205x6LXnwUtqRO6iPqQe7IklzXAsVaZcsNEQHjPFWQqfps1/EntG Jy38ZNTcIKQou6lRhpItUbF0uVih99AovoAVIttRvXOTBpYCyT8PrBm5Dvtk33T7Km6Z +yng== X-Gm-Message-State: APf1xPBfikeqhzqr0epMf+uiM6HhmHdtguWOjHBMSpu2yGGrIUrUZTHo YfAW9pqYwnu27vxXu4yaSeg= X-Google-Smtp-Source: AH8x226nUfEhVg8Vyl9J8VDbubsGWT3LH2zBb8HngjWDjHgO2ig5lG1AqDSIKZ2hikzugtIsXXFwHg== X-Received: by 10.98.93.144 with SMTP id n16mr2273844pfj.195.1517833310236; Mon, 05 Feb 2018 04:21:50 -0800 (PST) Received: from roblaptop (d49-188-34-95.sun1.vic.optusnet.com.au. [49.188.34.95]) by smtp.gmail.com with ESMTPSA id m65sm17985440pfc.150.2018.02.05.04.21.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Feb 2018 04:21:49 -0800 (PST) Message-ID: <1517832980.2860.7.camel@gmail.com> Subject: Re: weird result by changing type enum array to text array of a column From: rob stone To: Thomas Poty , pgsql-general@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Mon, 05 Feb 2018 23:16:20 +1100 Mime-Version: 1.0 X-Mailer: Evolution 3.26.2-1 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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