Re: Altering multiple column types

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re: Altering multiple column types
Дата
Msg-id CAKoxK+55KJ9mnasQsTCdOXGty=nDPTqXOq_KUWRMhQDZ_BkjSg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Altering multiple column types  (Bharanee Rathna <deepfryed@gmail.com>)
Список pgsql-general
On Fri, Aug 2, 2019 at 10:06 AM Bharanee Rathna <deepfryed@gmail.com> 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Tony Shelver
Дата:
Сообщение: Re: PGAdmin4.11.1 on Ubuntu 18.04
Следующее
От: Durumdara
Дата:
Сообщение: PGSQL "macro" or "inplace subfunction"?