ALTER TABLE ADD UNIQUE .....

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ALTER TABLE ADD UNIQUE .....
Date: 2003-11-11 07:55:50
Message-ID: 200311111325.50036.mallah@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi ,

Looks like ADD UNIQUE( some_fuc( some_feild) ) is not supported with add constraint.
the only way is to add the constriant is using UNIQUE INDEX .

Is it a bug or intended behaviour?

Regds
Mallah.

in 7.3.4
~~~~~~~~~~~~

tradein_clients=# ALTER TABLE general.email_master ADD CONSTRAINT
email_master_uniq_lower_btrim_email UNIQUE( lower(email) );

ERROR: parser: parse error at or near "(" at character 99
tradein_clients=#

tradein_clients=#
tradein_clients=# CREATE UNIQUE INDEX email_master_uniq_lower_btrim_email on general.email_master( lower(email) );
ERROR: Cannot create unique index. Table contains non-unique values

Well the SQL has failed but it was parsed successfully.

tradein_clients=#

SAME PROBLEM IN PGSQL 7.4 RC2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

template1=# alter table t_a add constraint "a" UNIQUE (email);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "a" for table "t_a"
ALTER TABLE
template1=# alter table t_a add constraint "b" UNIQUE (lower(email));
ERROR: syntax error at or near "(" at character 54
template1=#

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-11-11 08:11:39 Problem with create index
Previous Message frank_lupo 2003-11-11 07:36:20 Re: drop user question