From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | "George A(dot)J" <jinujosein(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Case Insensitive comparison |
Date: | 2003-09-25 04:45:21 |
Message-ID: | 200309242145.21087.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | sad | 2003-09-25 04:55:57 | Re: Large Objects and Bytea |
Previous Message | Kumar | 2003-09-25 04:11:28 | Large Objects and Bytea |