Re: Selecting all records which are in upper case

From: Amitabh Kant <amitabhkant(at)gmail(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Amitabh Kant <amitabhkant(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting all records which are in upper case
Date: 2011-08-27 10:28:11
Message-ID: CAPTAQBJrjR_rvW4D1CwJ5O3NRJM03Km2hcuJvqqMxPjXQf+bmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Aug 27, 2011 at 3:40 PM, Martijn van Oosterhout
<kleptog(at)svana(dot)org>wrote:

> On Sat, Aug 27, 2011 at 03:12:44PM +0530, Amitabh Kant wrote:
> > Hello
> >
> > I have a simple table 'location' :
> > id -> Int (associated with a sequence)
> > name -> Character varying (100)
> >
> > I have to delete all records where values in name field are all in upper
> > case. For example, if the test data is as follows:
>
> Might not work if you have non-ascii characters (but your example code
> breaks there too), but what about:
>
> DELETE ... WHERE upper(name) = name;
>
> Have a nice day,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
>

Thanks Martin. Definitely a much simpler way. I also cross-checked it on my
table, and it does work on non-ascii characters. It is only returning me
upper case entries. All other entries remain unaffected.

Amitabh

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2011-08-27 11:29:56 Re: documentation for hashtext?
Previous Message José María Terry Jiménez 2011-08-27 10:15:52 Re: Performing upgrade to latest minor release using PGDG RPMs