Re: Exception handling from trigger

From: Vlad Dimitriu <vlad(dot)dimitriu(at)base(dot)ro>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Exception handling from trigger
Date: 2004-08-09 17:38:36
Message-ID: 4117B69C.8080104@base.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:

>You can't. From a logical perspective this is sensible, because the
>trigger is handed data already formed into a tuple. If the presented
>tuple contained a mycolumn value wider than 64 characters then it would
>not be a legal value of the rowtype (any more than if, say, the column
>value were an integer and not a varchar at all).
>
>What I'd suggest if you want this is to remove the datatype restriction
>and instead rely on your trigger to enforce the limitation.
>
>
>
I just realised that. I would design those columns as text
and enforce value length restrictions with triggers.

It's a false problem: I define the data type for a field and
want to check his value after the exception that I can't fit
larger data into my field.

Thank you, Rod, Tom ....

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2004-08-09 17:39:41 Re: Suggestions on storing re-occurring calendar events
Previous Message Josh Berkus 2004-08-09 17:33:47 Re: surrogate keys and replication.