Skip site navigation (1) Skip section navigation (2)

primary key on lower(varchar)

From: <me(at)alternize(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: primary key on lower(varchar)
Date: 2006-01-07 00:28:07
Message-ID: 0cfb01c61321$3b6d86c0$0201a8c0@iwing (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
hi list

why can't i define a primary key on a varchar field as being lower(field)?

i'm getting the following error:

ERROR:  syntax error at or near "(" at character 94:   PRIMARY KEY ((lower(e_name) ));

here's the sql script:

ALTER TABLE "oldtables"."lexikon_entries"
  DROP CONSTRAINT "lexikon_entries_pkey" RESTRICT;

ALTER TABLE "oldtables"."lexikon_entries"
  ADD CONSTRAINT "lexikon_entries_pkey" 
  PRIMARY KEY ((lower(e_name) ));

ALTER INDEX "oldtables"."lexikon_entries_pkey"
  OWNER TO "db_outnow";

this seems to work for normal indices... do i really have to create a 2nd index on the same field?

- thomas


pgsql-novice by date

Next:From: Michael FuhrDate: 2006-01-07 02:26:51
Subject: Re: SQL Question
Previous:From: operationsengineer1Date: 2006-01-07 00:02:53
Subject: SQL Question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group