Re: [GENERAL] Best way to store case-insensitive data?

2010-06-13 Thread Lew
Please don't top-post. Mike Christensen wrote: Ah, I should probably upgrade to 8.4. However, I'll probably just wait for 9.0 to come out. So it seems like citext will be about the same as casting both sides to LOWER(), plus putting an index on the lowercase version of the text. I'd probably

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-12 Thread Adrian von Bidder
On Friday 11 June 2010 09.27:15 Michal Politowski wrote: [email address local part is case sensitive] In practice I've yet to see a system having both smith and Smith and them being different, but still it is theoretically posible. I routinely modify email addresses I store to my addressbook

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-12 Thread Scott Marlowe
2010/6/11 Mike Christensen m...@kitchenpc.com: Yea this is a valid point.  It's very possible my design won't work for the long term, and at some point I'll have to store the email name exactly as it was entered, and allow the lookup logic to be case insensitive with a lowercase index.  

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-12 Thread Scott Marlowe
n Sat, Jun 12, 2010 at 3:21 PM, Scott Marlowe scott.marl...@gmail.com wrote: Performance test the index: create test_index on table (lower(fieldname)); versus storing the emails in lower case. Some quick testing on that tells me that storing in lower case will be about twice as fast at

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-11 Thread Adrian von Bidder
Heyho! On Thursday 10 June 2010 22.50:23 Mike Christensen wrote: 2) Every time the user updates or saves their email, store it in lowercase, and every time I lookup an email, pass in a lowercase email. I'd do it this way. Plus either a CHECK condition on the table (email = lowercase(email))

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-11 Thread Mike Christensen
Yup, I actually ended up doing this with this constraint: ALTER TABLE Users ADD CONSTRAINT check_email CHECK (email ~ E'^[^A-Z]+$'); However, I like your version better so I'll use that instead :) Mike On Thu, Jun 10, 2010 at 11:48 PM, Adrian von Bidder avbid...@fortytwo.ch wrote: Heyho! On

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-11 Thread Michal Politowski
On Thu, 10 Jun 2010 13:50:23 -0700, Mike Christensen wrote: I have a column called email that users login with, thus I need to be able to lookup email very quickly. The problem is, emails are case-insensitive. I want f...@bar.com to be able to login with f...@bar.com as well. There's two

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-11 Thread Mike Christensen
Yea this is a valid point. It's very possible my design won't work for the long term, and at some point I'll have to store the email name exactly as it was entered, and allow the lookup logic to be case insensitive with a lowercase index. However, I think the way I have it now should not break

[GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Mike Christensen
I have a column called email that users login with, thus I need to be able to lookup email very quickly. The problem is, emails are case-insensitive. I want f...@bar.com to be able to login with f...@bar.com as well. There's two ways of doing this, that I can see: 1) Every time I lookup an

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Mike Christensen
Right now, I'm running 8.3.4 on Windows 2003, and I just used the MSI installer to install it. On Thu, Jun 10, 2010 at 2:18 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Thu, Jun 10, 2010 at 3:16 PM, Mike Christensen m...@kitchenpc.com wrote: Where do I get info on installing this? Very

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Andy Colson
On 6/10/2010 3:50 PM, Mike Christensen wrote: I have a column called email that users login with, thus I need to be able to lookup email very quickly. The problem is, emails are case-insensitive. I want f...@bar.com to be able to login with f...@bar.com as well. There's two ways of doing

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Mike Christensen
Ah, I should probably upgrade to 8.4. However, I'll probably just wait for 9.0 to come out. So it seems like citext will be about the same as casting both sides to LOWER(), plus putting an index on the lowercase version of the text. I'd probably use that if it were out of the box, but I'm

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Scott Marlowe
On Thu, Jun 10, 2010 at 2:50 PM, Mike Christensen m...@kitchenpc.com wrote: I have a column called email that users login with, thus I need to be able to lookup email very quickly.  The problem is, emails are case-insensitive.  I want f...@bar.com to be able to login with f...@bar.com as well.

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Scott Marlowe
On Thu, Jun 10, 2010 at 2:50 PM, Mike Christensen m...@kitchenpc.com wrote: I have a column called email that users login with, thus I need to be able to lookup email very quickly.  The problem is, emails are case-insensitive.  I want f...@bar.com to be able to login with f...@bar.com as well.

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Mike Christensen
Where do I get info on installing this? On Thu, Jun 10, 2010 at 2:15 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Thu, Jun 10, 2010 at 2:50 PM, Mike Christensen m...@kitchenpc.com wrote: I have a column called email that users login with, thus I need to be able to lookup email very

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Steve Atkins
On 6/10/2010 3:50 PM, Mike Christensen wrote: I have a column called email that users login with, thus I need to be able to lookup email very quickly. The problem is, emails are case-insensitive. I want f...@bar.com to be able to login with f...@bar.com as well. There's two ways of doing

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Mike Christensen
From this site: http://developer.postgresql.org/pgdocs/postgres/citext.html I couldn't tell if you still had to create an index on the lower case value. It seems that it basically mimics the WHERE LOWER(email) = LOWER(?) method. Since this part is incredibly performance critical, maybe I'm

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Scott Marlowe
On Thu, Jun 10, 2010 at 3:16 PM, Mike Christensen m...@kitchenpc.com wrote: Where do I get info on installing this? Very much depends on OS and how you installed pgsql -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Best way to store case-insensitive data?

2010-06-10 Thread Scott Marlowe
On Thu, Jun 10, 2010 at 3:34 PM, Mike Christensen m...@kitchenpc.com wrote: From this site: http://developer.postgresql.org/pgdocs/postgres/citext.html I couldn't tell if you still had to create an index on the lower case value.  It seems that it basically mimics the WHERE LOWER(email) =