Postgresql: Remove last char in text-field if the column ends with minus sign

From: Sarang Dave <saranghdave(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Postgresql: Remove last char in text-field if the column ends with minus sign
Date: 2010-12-16 14:52:27
Message-ID: AANLkTik+FOcjkiirmZx-Ebq+rn1k56b_+-bLYxjn9eto@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello sir,

I want to remove the last char in a column if it ends with the minus sign.
How could I do this in postgresql?

For example:

sdfs-dfg4t-etze45z5z- => sdfs-dfg4t-etze45z5z

gsdhfhsfh-rgertggh => stay untouched

Is there an easy syntax I can use?

Thanking You.

With Regards,
Sarang Dave

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gabi Julien 2010-12-16 15:15:14 Fwd: Re: Postgresql 9.1 pg_last_xact_replay_timestamp limitations
Previous Message Merlin Moncure 2010-12-16 14:44:11 Re: [HACKERS] getting composite types info from libpq