Обсуждение: upper case constraint?

Поиск
Список
Период
Сортировка

upper case constraint?

От
"Gowey, Geoffrey"
Дата:
Just wondering if anyone knows off hand how to make it so all inserts on a
column will wind up being tranparently stored as uppercase (ex: ee1234567 =
EE1234567).

Geoff

Re: upper case constraint?

От
Doug McNaught
Дата:
"Gowey, Geoffrey" <ggowey@rxhope.com> writes:

> Just wondering if anyone knows off hand how to make it so all inserts on a
> column will wind up being tranparently stored as uppercase (ex: ee1234567 =
> EE1234567).

Sounds like a good application for a trigger.

-Doug
--
In a world of steel-eyed death, and men who are fighting to be warm,
Come in, she said, I'll give you shelter from the storm.    -Dylan

Re: upper case constraint?

От
Stephan Szabo
Дата:
On Tue, 25 Sep 2001, Gowey, Geoffrey wrote:

> Just wondering if anyone knows off hand how to make it so all inserts on a
> column will wind up being tranparently stored as uppercase (ex: ee1234567 =
> EE1234567).

Probably a trigger, before update/insert on table:

create function gouppertable_col() returns opaque as '
begin
 NEW.col := upper(NEW.col);
 return NEW;
end;
' language 'plpgsql';


Re: upper case constraint?

От
Pedro Alves
Дата:
    One turnarround solution I use for that is to make the convertion to
uppercase in the script prior to the insertion. If that is your case, u can
do that too. Nevertheless, it seem easy to make a function toupper(), if it
does not exists yet


On Tue, Sep 25, 2001 at 12:43:58PM -0400, Gowey, Geoffrey wrote:
> Just wondering if anyone knows off hand how to make it so all inserts on a
> column will wind up being tranparently stored as uppercase (ex: ee1234567 =
> EE1234567).
>
> Geoff
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
Pedro Miguel G. Alves

THINK - Tecnologias de Informa��o
Av. Defensores de Chaves n� 15 4�D, 1000-109 Lisboa Portugal
Tel: +351 21 3590285   Fax: +351 21 3582729
HomePage: www.think.co.pt