From: | Luca Ferrari <fluca1978(at)gmail(dot)com> |
---|---|
To: | Bharanee Rathna <deepfryed(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Altering multiple column types |
Date: | 2019-08-02 06:49:47 |
Message-ID: | CAKoxK+4-22rirw0mNNq4Yw9huiSfqzn100haygyVqLR8gsmYmw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Aug 2, 2019 at 7:42 AM Bharanee Rathna <deepfryed(at)gmail(dot)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)
From | Date | Subject | |
---|---|---|---|
Next Message | Luca Ferrari | 2019-08-02 07:43:49 | Re: Altering multiple column types |
Previous Message | Bharanee Rathna | 2019-08-02 05:41:27 | Altering multiple column types |