Re: Altering multiple column types

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re: Altering multiple column types
Дата
Msg-id CAKoxK+4-22rirw0mNNq4Yw9huiSfqzn100haygyVqLR8gsmYmw@mail.gmail.com
обсуждение исходный текст
Ответ на Altering multiple column types  (Bharanee Rathna <deepfryed@gmail.com>)
Список pgsql-general
On Fri, Aug 2, 2019 at 7:42 AM Bharanee Rathna <deepfryed@gmail.com> wrote:
>
> Hi,
>
> I'm encountering an issue altering multiple column types in a single ALTER TABLE
>
> psql (12beta2, server 11.4)

it is working on my 11.4 with psql 11.4. Could it be a problem of psql
version 12? Can you try again with a psql "stable"?

testdb=> create table users(id serial primary key, name varchar(255),
age int, email varchar(255));
CREATE TABLE
testdb=> alter table users alter column name type text, alter column
email type text;
ALTER TABLE
testdb=> drop table users;
DROP TABLE
testdb=> create table users(id serial primary key, name varchar(255),
age int, email varchar(255));
CREATE TABLE
testdb=> create index users_email_idx on users(email);
CREATE INDEX
testdb=> alter table users alter column name type text, alter column
email type text;
ALTER TABLE
testdb=> \d users
                            Table "public.users"
 Column |  Type   | Collation | Nullable |              Default
--------+---------+-----------+----------+-----------------------------------
 id     | integer |           | not null | nextval('users_id_seq'::regclass)
 name   | text    |           |          |
 age    | integer |           |          |
 email  | text    |           |          |
Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
    "users_email_idx" btree (email)

testdb=> select version();
                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 11.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
8.3.0-6ubuntu1~18.10.1) 8.3.0, 64-bit
(1 row)



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

Предыдущее
От: Bharanee Rathna
Дата:
Сообщение: Altering multiple column types
Следующее
От: Luca Ferrari
Дата:
Сообщение: Re: Altering multiple column types