[GENERAL] Error size varchar

2003-10-29 Thread Edwin Quijada




Hi!!
I got error about a length field varchar. I have a table with a field type 
varchar(20) but if I try to set to this field more than 20 characters I got 
error.
I did a function to control the length of data and put it on trigger but 
when it ocurrs I got the error anyway and the trigger not works.
This error is over than trigger execution??

This is the error

ERROR:  value too long for type character varying(30)

*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
Surf and talk on the phone at the same time with broadband Internet access. 
Get high-speed for as low as $29.95/month (depending on the local service 
providers in your area).  https://broadband.msn.com

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Error size varchar

2003-10-29 Thread Edwin Quijada
wHAT IS unconstrained varchar???



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Tom Lane [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Error size varchar Date: Wed, 29 Oct 2003 11:28:23 
-0500

Edwin Quijada [EMAIL PROTECTED] writes:
 I got error about a length field varchar. I have a table with a field 
type
 varchar(20) but if I try to set to this field more than 20 characters I 
got
 error.
 I did a function to control the length of data and put it on trigger but
 when it ocurrs I got the error anyway and the trigger not works.

The length constraint is checked before triggers are fired, I believe.
If you want silent truncation rather than an error, use a text column
(or unconstrained varchar) and put the truncation behavior into your
trigger.
			regards, tom lane
_
Fretting that your Hotmail account may expire because you forgot to sign in 
enough? Get Hotmail Extra Storage today!   
http://join.msn.com/?PAGE=features/es

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [GENERAL] Error size varchar

2003-10-29 Thread Adam Kavan
At 05:06 PM 10/29/03 +, Edwin Quijada wrote:

wHAT IS unconstrained varchar???


Define the column as just varchar.  This allows a string of any 
length.  Then have a trigger truncate it after it is inserted.

--- Adam Kavan
--- [EMAIL PROTECTED]


---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [GENERAL] Error size varchar

2003-10-29 Thread Tom Lane
Edwin Quijada [EMAIL PROTECTED] writes:
 I got error about a length field varchar. I have a table with a field type 
 varchar(20) but if I try to set to this field more than 20 characters I got 
 error.
 I did a function to control the length of data and put it on trigger but 
 when it ocurrs I got the error anyway and the trigger not works.

The length constraint is checked before triggers are fired, I believe.
If you want silent truncation rather than an error, use a text column
(or unconstrained varchar) and put the truncation behavior into your
trigger.

regards, tom lane

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match