Thread: doubts about a constraint's definition
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!
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
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 > 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
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 > > 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 >
"enediel" <enediel@com.ith.tur.cu> writes: > 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 CREATE UNIQUE INDEX foo ON tab (UPPER(column)); regards, tom lane