pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Return trimmed string from the query
Date: Mon, 2 Nov 2026 13:10:42 +0100
Message-ID: <auh9wivxJA02g5fJ@depesz.com> (raw)
In-Reply-To: <CA+FnnTwZFTaBGvaQc1eqkgFJkev+BSbsn1oTaWwbKE5BLfKNRw@mail.gmail.com>
References: <CA+FnnTwZFTaBGvaQc1eqkgFJkev+BSbsn1oTaWwbKE5BLfKNRw@mail.gmail.com>

On Sun, Nov 01, 2026 at 01:17:10AM -0600, Igor Korot wrote:
> hi, ALL,
> Is there an option to return a trimmed string from the query?
> If I try to retrieve the char(10) from the table and the field only have
> "abc", how to prevent the value to be returned as "abc     "?

Others already helped, but also, please read:
https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don't_use_char(n)

Best regards,

depesz







view thread (10+ messages)  latest in thread

Message-ID: <auh9wivxJA02g5fJ@depesz.com>
Permalink:  ../auh9wivxJA02g5fJ@depesz.com/
Also on:    postgresql.org/message-id/auh9wivxJA02g5fJ@depesz.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: depesz@depesz.com, ikorot01@gmail.com
  Subject: Re: Return trimmed string from the query
  In-Reply-To: <auh9wivxJA02g5fJ@depesz.com>
  References: <CA+FnnTwZFTaBGvaQc1eqkgFJkev+BSbsn1oTaWwbKE5BLfKNRw@mail.gmail.com> <auh9wivxJA02g5fJ@depesz.com>

* 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