Re: Altering multiple column types - Mailing list pgsql-general

From Luca Ferrari
Subject Re: Altering multiple column types
Date
Msg-id CAKoxK+7s91K2OdtuAqaOgx4TigNofdOfDYrAAkm-Cm=Bh8CXqw@mail.gmail.com
Whole thread Raw
In response to Altering multiple column types  (Bharanee Rathna <deepfryed@gmail.com>)
Responses Re: Altering multiple column types
List pgsql-general
On Fri, Aug 2, 2019 at 9:39 AM Bharanee Rathna <deepfryed@gmail.com> wrote:
>
> Hi Luca,
>
> I've tried it with a different client and Postgres 10.9, no luck
>
> psql (10.3, server 10.9)

I've fired up a 12beta2 and it works, either with psql 12 or psql 11.4 on linux.
What if you run the statements within another client (pgadmin, a java
client or something else)?

% psql -U postgres testdb
psql (12beta2)
Type "help" for help.

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=# SELECT version();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 12beta2 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
8.3.0-6ubuntu1~18.10.1) 8.3.0, 64-bit
(1 row)




% ~/git/misc/PostgreSQL/pgenv/pgsql-11.4/bin/psql -U postgres testdb

psql (11.4, server 12beta2)
WARNING: psql major version 11, server major version 12.
         Some psql features might not work.
Type "help" for help.

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



pgsql-general by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: Altering multiple column types
Next
From: Bharanee Rathna
Date:
Subject: Re: Altering multiple column types