Search Postgresql Archives

Re: Altering multiple column types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 2, 2019 at 10:06 AM Bharanee Rathna <deepfryed@xxxxxxxxx> wrote:
>
> Hi Luca,
>
> testing this using docker images. I can replicate it with 10.9-alpine
>
> bash-5.0# psql -h127.0.0.1 -Upostgres test
> psql (10.9)
> Type "help" for help.
>
> test=# \d users
>                                     Table "public.users"
>  Column |          Type          | Collation | Nullable |              Default
> --------+------------------------+-----------+----------+-----------------------------------
>  id     | integer                |           | not null | nextval('users_id_seq'::regclass)
>  name   | character varying(255) |           |          |
>  age    | integer                |           |          |
>  email  | character varying(255) |           |          |
> Indexes:
>     "users_pkey" PRIMARY KEY, btree (id)
>     "users_email_idx" btree (email)
>     "users_name_idx" btree (name)

My fault!
I missed one index, so it is working with one index a two column alter
table, but not with two indexes:

testdb=# alter table users alter column name type text, alter column
email type text;
alter table users alter column name type text, alter column email type text;
psql: ERROR:  relation "users_name_idx" already exists


Therefore I think it is a strange behavior, I cannot explain.
I confirm the problem shows up in 11.4 and 12beta2, so I guess there's
must be a reason I don't understand.

Luca





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux