Re: How to force some char type columns to be stored in uppercase

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to force some char type columns to be stored in uppercase
Date: 2011-11-06 21:27:19
Message-ID: CAOR=d=3o5oaLTDY5BKpN9mh=DweX+CySgLypMm_Pd9U_338f8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/11/6 Andrus <kobruleht2(at)hot(dot)ee>:
> in 8.1+ many char(n) type columns must be in uppercase in database.
> What is best way to force this ?
>
> Should insert and update triggers created for every table or is there better
> way,
> for example by creation domain or adding some attribute to column and
> creating global trigger?

A simple trigger like this should work fine. You're basically throwing
an upper() around the field in a function and calling that a trigger.
If you decided to do it in the application, then throwing a constraint
around each updated / inserted text col is pretty easy too.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message NTPT 2011-11-06 21:52:22 Re: Re: [GENERAL] Named / preparsed / preplaned(prepared) queries - Feature proposal
Previous Message Cstdenis 2011-11-06 20:15:09 Re: Distinct on a non-sort column