Re: Auto-uppercase inserted column

From: Jurgen Defurne <defurnj(at)glo(dot)be>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, postgreSQL general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Auto-uppercase inserted column
Date: 2000-05-20 05:56:34
Message-ID: 39262911.BC2D9710@glo.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote:

> Is there a way to automatically uppercase a column upon insert or
> update?
>
> I don't think rules can do that because of the problem of recursion.
> The only way I think it can be done is using triggers. Is that correct?
>

Since triggers are available in postgreSQL, that should be the way, yes.
You have to have access to the NEW values in your trigger, and then you
should say something like
NEW.field := upper(NEW.field) ;

In older database systems this would be done in the entry system, but
then you have a coupling between your application and the database.

Good luck.

Jurgen Defurne
defurnj(at)glo(dot)be

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-05-20 06:01:22 Re: Columns in pg_shadow?
Previous Message Sascha Ziemann 2000-05-20 05:56:03 bool and NOT