Thread: Case of strings

Case of strings

From
"Simon Windsor"
Date:

Hi

 

I have moved an application from MySQL to PgSQL, and after the making changes I thought all was ok.

 

However, I have just realised that

 

Where A = ‘STRING’

 

Is not the same as

 

Where A =’String’

 

Is there anyway I can force the PgSQL to accept case equivalence, or must I add upper()/lower() to force the case and then make string tests?

 

Ie Where upper(A)=upper(‘String’)

 

Many thanx

 

Simon

 

Simon Windsor

Eml: simon.windsor@cornfield.org.uk

Tel: 01454 617689

Mob: 07960 321599

 


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Mailscanner thanks transtec Computers for their support.

Re: Case of strings

From
"cnliou"
Date:
>Is there anyway I can force the PgSQL to accept case
equivalence, or must I
>add upper()/lower() to force the case and then make string
tests?
>
>
>
>Ie Where upper(A)=upper('String')

I think you already answered your own question as pgsql
document does in section

"9.4. String Functions and Operators"

Regards,
CN

Re: Case of strings

From
Michael Chaney
Date:
On Fri, Feb 27, 2004 at 12:06:58PM -0000, Simon Windsor wrote:
> Hi
>
> I have moved an application from MySQL to PgSQL, and after the making
> changes I thought all was ok.
>
> However, I have just realised that
>
> Where A = 'STRING'
>
> Is not the same as
>
> Where A ='String'

This is standard SQL.  It's possible to use functions inside index
definitions, so you can force case and search on the same.

Michael
--
Michael Darrin Chaney
mdchaney@michaelchaney.com
http://www.michaelchaney.com/

Re: Case of strings

From
Paul Thomas
Date:
On 27/02/2004 12:06 Simon Windsor wrote:
> Is there anyway I can force the PgSQL to accept case equivalence, or must
> I
> add upper()/lower() to force the case and then make string tests?
>
>
>
> Ie Where upper(A)=upper('String')

You could use ilike

where a ilike 'string'

You can also use POSIX regular expressions.


--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+