doubts about a constraint's definition

Started by enedielabout 23 years ago3 messagesgeneral
Jump to latest
#1enediel
enediel@com.ith.tur.cu

Hello:
I've the following question:

I need to create a column, where the information is conserved in the same
way that it was written by the user, but the data of this column is unique
if it's only taken to capital

declaring a constraint
... unique(column name) is not enough to me 'cause

'ab'
'AB'
'aB'
....
will be accepted

Thanks in advance for any help
Enediel
Linux user 300141

Happy who can penetrate the secret causes of the things
�Use Linux!

#2enediel
enediel@com.ith.tur.cu
In reply to: enediel (#1)
Re: doubts about a constraint's definition

thanks Eric for the answer, but the question is how to keep the
information's integrity without convert strings to upper case.

I need to do that transparent to the user

Greetings
Enediel
Linux user 300141

Happy who can penetrate the secret causes of the things
�Use Linux!
----- Original Message -----
From: "Eric D�chaux" <edechaux@irci.fr>
To: "enediel" <enediel@com.ith.tur.cu>
Sent: Friday, March 21, 2003 6:14 AM
Subject: Re: [GENERAL] doubts about a constraint's definition

Hello, I think you can 'upcase' the string written by the user before
inserting it into the table.

Le Fri, 21 Mar 2003 09:08:32 -0800
"enediel" <enediel@com.ith.tur.cu> a ecrit :

Hello:
I've the following question:

I need to create a column, where the information is conserved in the same
way that it was written by the user, but the data of this column is unique
if it's only taken to capital

declaring a constraint
... unique(column name) is not enough to me 'cause

'ab'
'AB'
'aB'
....
will be accepted

Thanks in advance for any help
Enediel
Linux user 300141

Happy who can penetrate the secret causes of the things
�Use Linux!

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--

Eric D�chaux

IRCI
87 rue Bizet
94800 Villejuif

Tel Poste : +33 (0) 1 47 26 71 03
Tel Standard : +33 (0) 1 47 26 37 73
Email : edechaux@irci.fr

#3enediel
enediel@com.ith.tur.cu
In reply to: enediel (#1)
Re: doubts about a constraint's definition

Thanks Peter for your attention, it's exactly what I needed
:>)

Greetings
Enediel
Linux user 300141

Happy who can penetrate the secret causes of the things
�Use Linux!
----- Original Message -----
From: "Peter Gibbs" <peter@emkel.co.za>
To: "enediel" <enediel@com.ith.tur.cu>; "postgresql"
<pgsql-general@postgresql.org>
Sent: Friday, March 21, 2003 6:32 AM
Subject: Re: [GENERAL] doubts about a constraint's definition

enediel wrote:

I need to create a column, where the information is conserved in the

same

way that it was written by the user, but the data of this column is

unique

Show quoted text

if it's only taken to capital

declaring a constraint
... unique(column name) is not enough to me 'cause

'ab'
'AB'
'aB'
....
will be accepted

Create a unique functional index e.g.
create unique index index_name on table_name (upper(fieldname));
--
Peter Gibbs
EmKel Systems

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html