Re: ALTERING COLLATION

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: aditya desai <admad123(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTERING COLLATION
Date: 2021-12-30 15:58:28
Message-ID: 2269504.1640879908@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

aditya desai <admad123(at)gmail(dot)com> writes:
> I had to alter COLLATION of one of the table column as shown below due to
> business requirements.
> alter TABLE workflow alter status_id TYPE character varying(10) COLLATE "C"
> Is there any way to do this at server level?

Where's the problem?

test=# create table workflow(status_id character varying(10) collate "en_US");
CREATE TABLE
test=# \d workflow
Table "public.workflow"
Column | Type | Collation | Nullable | Default
-----------+-----------------------+-----------+----------+---------
status_id | character varying(10) | en_US | |

test=# alter TABLE workflow alter status_id TYPE character varying(10) COLLATE "C";
ALTER TABLE
test=# \d workflow
Table "public.workflow"
Column | Type | Collation | Nullable | Default
-----------+-----------------------+-----------+----------+---------
status_id | character varying(10) | C | |

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Klingler 2022-01-05 12:19:11 Return product category with hierarchical info
Previous Message aditya desai 2021-12-30 07:42:24 ALTERING COLLATION