X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94444D1B1C8; Sun, 25 Jul 2004 20:46:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60397-09; Sun, 25 Jul 2004 23:46:33 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id A1023D1B4A2; Sun, 25 Jul 2004 20:46:30 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i6PNkRqf045977; Sun, 25 Jul 2004 23:46:28 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i6PNfITg045551; Sun, 25 Jul 2004 23:41:18 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.general,comp.databases.postgresql.sql Subject: Re: constraitnt on case sensetive and case insensetive columns Date: Mon, 26 Jul 2004 01:41:05 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 53 Message-ID: <41044511.20303@bigfoot.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: A Bruce User-Agent: Mozilla Thunderbird 0.7.1 (Windows/20040626) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.84.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: "pgsql-general@postgresql.org.pgsql-sql"@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/720 X-Sequence-Number: 63319 -----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-----