Thread: ALTERING COLLATION

ALTERING COLLATION

From
aditya desai
Date:
Hi,
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?

Regards,
Aditya.

Re: ALTERING COLLATION

From
Tom Lane
Date:
aditya desai <admad123@gmail.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