473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

constraitnt on case sensetive and case insensetive columns


hello,

I am attempting to convert a oracle database to postgresql and I am having
some problems creating a constraint across multiple columns which are a
mixture of case insensitive and case sensitive.

The original oracle database created an index with:
CREATE UNIQUE INDEX hatidx ON hats (upper(name), upper(server), login);

However postgresql can handle multiple columns in the index, or one function,
but not multiple functions, thus this fails.

Queries are only done using the actual values, so the presence of the
index is not required for performance reasons, and exists only to
enforce the constraint that (upper(name), upper(server), login) is a
unique tuple. Is there anyway to create a constraint which will check
this? I suspect it would be possible to create a trigger to check this,
however this is a little ugly, and i would like something more similar to
to the original if possible.

Any suggestions as to how to approach this would be greatly appreciated,
-bruce

Nov 23 '05 #1
2 1589
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A Bruce wrote:

| hello,
|
| I am attempting to convert a oracle database to postgresql and I am having
| some problems creating a constraint across multiple columns which are a
| mixture of case insensitive and case sensitive.
|
| The original oracle database created an index with:
| CREATE UNIQUE INDEX hatidx ON hats (upper(name), upper(server), login);
|
| However postgresql can handle multiple columns in the index, or one function,
| but not multiple functions, thus this fails.
|
| Queries are only done using the actual values, so the presence of the
| index is not required for performance reasons, and exists only to
| enforce the constraint that (upper(name), upper(server), login) is a
| unique tuple. Is there anyway to create a constraint which will check
| this? I suspect it would be possible to create a trigger to check this,
| however this is a little ugly, and i would like something more similar to
| to the original if possible.
|
| Any suggestions as to how to approach this would be greatly appreciated,
| -bruce
|

I'm using the 7.4.x version and what you ask for is supported:

regression=# create table test ( a varchar, b varchar, c varchar );
CREATE TABLE
regression=# create unique index test_idx on test ( upper(a), upper(b), c);
CREATE INDEX

Regards
Gaetano Mendola

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBBET87UpzwH2SGd4RAvUeAJ4vG0CxIQdUe8KjsYs/kk7yC1/dLQCgsy9t
IZrziKueFyht39zm+/XoD8w=
=gA20
-----END PGP SIGNATURE-----
Nov 23 '05 #2
I'm using the 7.4.x version and what you ask for is supported:

regression=# create table test ( a varchar, b varchar, c varchar );
CREATE TABLE
regression=# create unique index test_idx on test ( upper(a), upper(b), c);
CREATE INDEX

Thank you for pointing this out, I am currently using 7.3 but I will
upgrade.

Thanks again!
-Bruce

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lis | last post by:
Hi! I need have records on different languages simultaneously on some DB for i18n of my application. Application is multilingual. I decide use for this UNICODE. (UNICODE is encoding for my...
7
by: C# newbie | last post by:
Hi, How can I make my query to return both "Bob" & "bob" (during search for a string) ? any idea? thanks
6
by: Ajay | last post by:
Hi I am trying to do the following. I have a set of records Example 1 Test 2 test 3 TEST 4 ACCESS 5 EXCEL
2
by: vulcaned | last post by:
Hi All, In access97 I have a query who's record source is a linked sql table and when I enter a value the Part nbr filed to select by (ex: A10295X ) I get back only records that have a case match....
5
by: Jeff S | last post by:
I'm getting started with C# and was just wondering if C# veterans LIKE the fact that the language is case sensitive. If so, how is case sensitivity helpful? Do you create multiple variables,...
15
by: Thomas Scheiderich | last post by:
I thought I read that the case for the variable names is important. For example Dim Wheel As Integer Wheel here is a different variable from WHEEL. Is this correct?
10
by: Agnes | last post by:
I found that store procedure with vb.net (seems ignore case senstive) I type "lax" as code, and it returns the correct answer , How come ?? I can't set the upper case in that textbox, BUT I need...
0
by: ambika_se | last post by:
Hi all I want to make a Xquery which is like this for $x in doc("file:///C:/Science.xml")//tva2:title where $x//node() return $x Its working perfectly but if i try for( biological science) its...
7
by: vunet.us | last post by:
So, I came across the problem every developer comes across with once: case in SQL. My users login with their selected user name and when SQL checks for user name value, case is ignored. For...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.