pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Ron Johnson <ronljohnsonjr@gmail.com>
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: char column with a single space as the default not working
Date: Fri, 01 Dec 2023 08:15:21 +0100
Message-ID: <34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at> (raw)
In-Reply-To: <CANzqJaA5Az_2z8X3_T3ieypvqQkFDuEbbtF7Uu0L0tXEKiyXjw@mail.gmail.com>
References: <f7b61d30-3b95-463a-9627-fed806e5e2db@quadratum-braccas.com>
	<CAJ=80GV3NaKeRi9GDXa+bA-Zck0YYHwGa90v70GBwoyi1EQftQ@mail.gmail.com>
	<507459.1701374156@sss.pgh.pa.us>
	<CANzqJaA5Az_2z8X3_T3ieypvqQkFDuEbbtF7Uu0L0tXEKiyXjw@mail.gmail.com>

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





view thread (8+ messages)

Message-ID: <34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at>
Permalink:  ../34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at/
Also on:    postgresql.org/message-id/34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: char column with a single space as the default not working
  In-Reply-To: <34a83d6f68c2d513a88acb40cdc581c43586a746.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox