Re: case-insensitive database

Lists: pgsql-general
From: "Relaxin" <noname(at)spam(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: case-insensitive database
Date: 2003-09-13 11:00:16
Message-ID: bjutbd$2fvr$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is there a way to make Postgresql case-INSENSITIVE?

Thanks


From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-13 12:07:25
Message-ID: m3u17gsxhe.fsf@chvatal.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Quoth "Relaxin" <noname(at)spam(dot)com>:
> Is there a way to make Postgresql case-INSENSITIVE?

It already is.

portfolio=# select * from stocks limit 1;
symbol | description | exchange
--------+-------------+----------
AADBX | AADBX | NYSE
(1 row)

portfolio=# sELeCT * FROM STOCKS LIMIT 1;
symbol | description | exchange
--------+-------------+----------
AADBX | AADBX | NYSE
(1 row)

Those queries were cased differently, but were recognized as being
functionally identical.
--
output = ("aa454" "@" "freenet.carleton.ca")
http://cbbrowne.com/info/linux.html
debugging, v:
Removing the needles from the haystack.


From: "Relaxin" <noname(at)spam(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-13 17:54:44
Message-ID: bjvlkk$1i94$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

No, I mean the data.

select * from stocks where symbol = 'AADBX'
and
select * from stocks where symbol = 'aadbx'

would bring up the same result set.

"Christopher Browne" <cbbrowne(at)acm(dot)org> wrote in message
news:m3u17gsxhe(dot)fsf(at)chvatal(dot)cbbrowne(dot)com(dot)(dot)(dot)
> Quoth "Relaxin" <noname(at)spam(dot)com>:
> > Is there a way to make Postgresql case-INSENSITIVE?
>
> It already is.
>
> portfolio=# select * from stocks limit 1;
> symbol | description | exchange
> --------+-------------+----------
> AADBX | AADBX | NYSE
> (1 row)
>
> portfolio=# sELeCT * FROM STOCKS LIMIT 1;
> symbol | description | exchange
> --------+-------------+----------
> AADBX | AADBX | NYSE
> (1 row)
>
> Those queries were cased differently, but were recognized as being
> functionally identical.
> --
> output = ("aa454" "@" "freenet.carleton.ca")
> http://cbbrowne.com/info/linux.html
> debugging, v:
> Removing the needles from the haystack.


From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: Relaxin <noname(at)spam(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-14 20:06:14
Message-ID: 3F64CA36.5010202@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Relaxin wrote:

>No, I mean the data.
>
>select * from stocks where symbol = 'AADBX'
>and
>select * from stocks where symbol = 'aadbx'
>
>would bring up the same result set.
>
>
>
Look in the manuals, there are SQL functions like:

STRTOLOWER( ); STRTOUPPER() like those in 'C'

Usage:
-------
SELECT *
FROM stocks
WHERE
STRTOLOWER( symbol ) = STRTOLOWER( 'AADBX' );


From: "Relaxin" <noname(at)spam(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-14 20:37:33
Message-ID: bk2jhq$lrc$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello....
Does anyone understand what is meant by a case-insensitive database.

Are there some collations that can be changed or is there just no way to
have a true case-insensitive Postgresql database?

Thanks

"Dennis Gearon" <gearond(at)fireserve(dot)net> wrote in message
news:3F64CA36(dot)5010202(at)fireserve(dot)net(dot)(dot)(dot)
> Relaxin wrote:
>
> >No, I mean the data.
> >
> >select * from stocks where symbol = 'AADBX'
> >and
> >select * from stocks where symbol = 'aadbx'
> >
> >would bring up the same result set.
> >
> >
> >
> Look in the manuals, there are SQL functions like:
>
> STRTOLOWER( ); STRTOUPPER() like those in 'C'
>
> Usage:
> -------
> SELECT *
> FROM stocks
> WHERE
> STRTOLOWER( symbol ) = STRTOLOWER( 'AADBX' );
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Relaxin <noname(at)spam(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-14 21:33:52
Message-ID: 20030914143230.W51678@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Sat, 13 Sep 2003, Relaxin wrote:

> Is there a way to make Postgresql case-INSENSITIVE?

Case insensitive in what regard?
That textual comparisons are done case-insensitively in queries?
That object names are determined case-insensitively?


From: darren(at)crystalballinc(dot)com
To: Relaxin <noname(at)spam(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-14 21:49:57
Message-ID: Pine.LNX.4.44.0309141748150.17390-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

select * from stocks where lower(symbol) = 'aadbx';
or
select * from stocks where symbol ilike =aadbx';
or
select * from stocks where symbol ~* 'aadbx';

HTH
Darren
On Sat, 13 Sep 2003, Relaxin wrote:

> No, I mean the data.
>
> select * from stocks where symbol = 'AADBX'
> and
> select * from stocks where symbol = 'aadbx'
>
> would bring up the same result set.
>
>
> "Christopher Browne" <cbbrowne(at)acm(dot)org> wrote in message
> news:m3u17gsxhe(dot)fsf(at)chvatal(dot)cbbrowne(dot)com(dot)(dot)(dot)
> > Quoth "Relaxin" <noname(at)spam(dot)com>:
> > > Is there a way to make Postgresql case-INSENSITIVE?
> >
> > It already is.
> >
> > portfolio=# select * from stocks limit 1;
> > symbol | description | exchange
> > --------+-------------+----------
> > AADBX | AADBX | NYSE
> > (1 row)
> >
> > portfolio=# sELeCT * FROM STOCKS LIMIT 1;
> > symbol | description | exchange
> > --------+-------------+----------
> > AADBX | AADBX | NYSE
> > (1 row)
> >
> > Those queries were cased differently, but were recognized as being
> > functionally identical.
> > --
> > output = ("aa454" "@" "freenet.carleton.ca")
> > http://cbbrowne.com/info/linux.html
> > debugging, v:
> > Removing the needles from the haystack.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Darren Ferguson


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Relaxin <noname(at)spam(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-15 00:27:14
Message-ID: 20030914172223.W53960@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Sat, 13 Sep 2003, Relaxin wrote:

> No, I mean the data.
>
> select * from stocks where symbol = 'AADBX'
> and
> select * from stocks where symbol = 'aadbx'
>
> would bring up the same result set.

Potentially on some systems it'd be possible to
generate a case insensitive collation as part of a locale
and then use such for LC_COLLATE on initdb which would make all
comparisons of text fields case insensitive. That wouldn't
let you choose some case sensitive and case insensitive
right now (until we supported different collations within
one database). Others have already given most of the normal
query change ways already I believe (ilike, using upper or
lower, etc).


From: "Relaxin" <noname(at)spam(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-15 01:05:50
Message-ID: bk338o$20mr$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thank you, that was the answer I was look for.

"Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com> wrote in message
news:20030914172223(dot)W53960(at)megazone(dot)bigpanda(dot)com(dot)(dot)(dot)
>
> On Sat, 13 Sep 2003, Relaxin wrote:
>
> > No, I mean the data.
> >
> > select * from stocks where symbol = 'AADBX'
> > and
> > select * from stocks where symbol = 'aadbx'
> >
> > would bring up the same result set.
>
> Potentially on some systems it'd be possible to
> generate a case insensitive collation as part of a locale
> and then use such for LC_COLLATE on initdb which would make all
> comparisons of text fields case insensitive. That wouldn't
> let you choose some case sensitive and case insensitive
> right now (until we supported different collations within
> one database). Others have already given most of the normal
> query change ways already I believe (ilike, using upper or
> lower, etc).
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Relaxin <noname(at)spam(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-15 03:26:57
Message-ID: 2786.1063596417@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> Potentially on some systems it'd be possible to
> generate a case insensitive collation as part of a locale
> and then use such for LC_COLLATE on initdb which would make all
> comparisons of text fields case insensitive.

Another possibility is to create a 'case insensitive text' datatype
that has its own case-insensitive comparison operators and associated
btree opclass. You would want to create an implicit cast to text and
an automatic cast from text so as to take advantage of the existing
text-type operations. I'm not sure whether this would work cleanly
or would result in can't-choose-the-operator-to-use errors, but it'd
be worth trying.

regards, tom lane


From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: Relaxin <noname(at)spam(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case-insensitive database
Date: 2003-09-15 06:52:40
Message-ID: 3F6561B8.8080507@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Relaxin wrote:

>Hello....
>Does anyone understand what is meant by a case-insensitive database.
>
>
You could define your own encoding, and use that.