Re: char column with a single space as the default not working - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: char column with a single space as the default not working
Date
Msg-id 34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at
Whole thread Raw
In response to Re: char column with a single space as the default not working  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-admin
On Thu, 2023-11-30 at 17:00 -0500, Ron Johnson wrote:
> > As David said, you're best off not using the char type.
> > The semantics around trailing spaces are too squishy for
> > my taste, and there's no real advantage compared to varchar
> > or text.
>
> How do you get a trailing space when trailing spaces are significant?

You would add a check constraint to verify it is there, and
if you want to automatically create training spaces, use a
BEFORE trigger.

Yours,
Laurenz Albe



pgsql-admin by date:

Previous
From: M Sarwar
Date:
Subject: Re: char column with a single space as the default not working
Next
From: Srinivasarao Oguri
Date:
Subject: Logical replication failed