Re: char column with a single space as the default not working

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: char column with a single space as the default not working
Date: 2023-12-01 07:15:21
Message-ID: 34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Srinivasarao Oguri 2023-12-02 13:52:07 Logical replication failed
Previous Message M Sarwar 2023-11-30 22:43:17 Re: char column with a single space as the default not working