Re: Case Insensitive comparison
От | Josh Berkus |
---|---|
Тема | Re: Case Insensitive comparison |
Дата | |
Msg-id | 200309242145.21087.josh@agliodbs.com обсуждение исходный текст |
Ответ на | Case Insensitive comparison ("George A.J" <jinujosein@yahoo.com>) |
Ответы |
Re: Case Insensitive comparison
|
Список | pgsql-sql |
jinujose, > i am using postgresql 7.3.x. I am converting a database in MS SQL server to > PostgreSQL. Good luck to you! > The main problems i am facing is that in sql server the text comparisons > are case insensitive. how can i compare text case insensitive in postgresql > without using an upper() or lower() function in both sides (=). Is there > any option to set in postgresql? Is there any problem in overriding the = > operator that compare text. ie droping the current operator = and creating > a new = operator(text,text). Does the existing = operator is using > internally by postgres for some porpose. please help I would *not* suggest modifying such a fundamental operator; you are very likely to break something. You can use "ILIKE" to compare text: 'Joe' ILIKE 'joE' == true You can also use the "regex" operator: 'Joe' ~* '^jOE$' == TRUE ... but that takes more adaptation. However, neither of the above approaches can be indexed. > Another problem is in creating function... > How can i create a function that accept and return any type. the type "any" > is not allowing as parameter or return type. Is it possible? i want to > create a function similar to NULLIF(). You can't, nor will you be able to -- in te future, some 7.4 functions will be able to *accept* any type, but they will still return a specific type. Instead, you need to create a seperate NULLIF() for each data type you're likely to use. -- Josh Berkus Aglio Database Solutions San Francisco
В списке pgsql-sql по дате отправления: