| From: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Return trimmed string from the query |
| Date: | 2026-11-01 15:13:18 |
| Message-ID: | CANzqJaBAqMtb4Nz9aUhbMEqBiuPEDsFZQ-_y_AEU5UsJN4cU0Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-odbc |
On Sun, Nov 1, 2026 at 1:43 AM Igor Korot <ikorot01(at)gmail(dot)com> 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 "?
>
TRIM() is the portable/standards method:
SELECT TRIM(TRAILING ' ' FROM a) FROM foo;
There are many useful string functions:
https://www.postgresql.org/docs/17/functions-string.html
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2026-11-01 15:49:26 | Re: Return trimmed string from the query |
| Previous Message | Igor Korot | 2026-11-01 15:13:10 | Fwd: Return trimmed string from the query |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2026-11-01 15:49:26 | Re: Return trimmed string from the query |
| Previous Message | Igor Korot | 2026-11-01 15:13:10 | Fwd: Return trimmed string from the query |