From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Phillip Smith <phillip(at)softworks(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Case Sensitivity |
Date: | 2011-01-13 15:14:10 |
Message-ID: | AANLkTi=mk9n3Szka_hy-wc8r8iBM-mHmQRmo9WPQ-hd1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
you should to use a citext datatype
http://www.postgresql.org/docs/9.0/interactive/citext.html
regards
Pavel Stehule
2011/1/13 Phillip Smith <phillip(at)softworks(dot)com>:
> Hi,
> I'm moving over from MS SQL. I've been googling this for ages now and
> suprisingly cannot find a clear answer.
>
> I want my data in tables to be case insensitive.
>
> This is so i can:
> 1. Put keys on natural key fields, for instance a product part number. I
> product number 'ABC123' inserted i need to disallow 'abc123' to be inserted
> as a second row. Please don't tell me i have to add another column holding a
> lowered version of the product number. My database is littered with this
> need and i would end up bloating my table schema.
>
> 2. I need to query case insensitively. SELECT * FROM product WHERE
> product_number = 'ABC123' should return the same row as SELECT * FROM
> product WHERE product_number = 'abc123'
>
> Is there a database wide collation setting i can make, or a case
> insensitive character type. There are lots of online posts regarding using
> LOWER function for querying. This is a workaround for point (2) but does not
> remedy point (1) above.
>
> Many thanks
>
> Phillip
>
> Phillip Smith
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Colson | 2011-01-13 15:24:06 | Re: Spatial data Loading and storing |
Previous Message | Phillip Smith | 2011-01-13 14:53:32 | Case Sensitivity |