Collation and Case Insensitivity

Поиск
Список
Период
Сортировка
От Phillip Smith
Тема Collation and Case Insensitivity
Дата
Msg-id D869A69BDB32184981F31AB9349C8C9B188D1D@exch-be34.exchange.local
обсуждение исходный текст
Ответы Re: Collation and Case Insensitivity  (Kenneth Marshall <ktm@rice.edu>)
Re: Collation and Case Insensitivity  (Susanne Ebrecht <susanne@2ndQuadrant.com>)
Список pgsql-novice
Hi,
 
Im 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. 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: batching commands with libpq
Следующее
От: Kenneth Marshall
Дата:
Сообщение: Re: Collation and Case Insensitivity