Re: Truncation of char, varchar types - Mailing list pgsql-hackers

From ncm@zembu.com (Nathan Myers)
Subject Re: Truncation of char, varchar types
Date
Msg-id 20010409133026.X3797@store.zembu.com
Whole thread Raw
In response to Truncation of char, varchar types  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Truncation of char, varchar types  (Peter Eisentraut <peter_e@gmx.net>)
Re: Truncation of char, varchar types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Apr 09, 2001 at 09:20:42PM +0200, Peter Eisentraut wrote:
> Excessively long values are currently silently truncated when they are
> inserted into char or varchar fields.  This makes the entire notion of
> specifying a length limit for these types kind of useless, IMO.  Needless
> to say, it's also not in compliance with SQL.
> 
> How do people feel about changing this to raise an error in this
> situation?  Does anybody rely on silent truncation?  Should this be
> user-settable, or can those people resort to using triggers?

Yes, detecting and reporting errors early is a Good Thing.  You don't 
do anybody any favors by pretending to save data, but really throwing 
it away.

We have noticed here also that object (e.g. table) names get truncated 
in some places and not others.  If you create a table with a long name, 
PG truncates the name and creates a table with the shorter name; but 
if you refer to the table by the same long name, PG reports an error.  
(Very long names may show up in machine- generated schemas.) Would 
patches for this, e.g. to refuse to create a table with an impossible 
name, be welcome?  

Nathan Myers
ncm@zembu.com


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Truncation of char, varchar types
Next
From: The Hermit Hacker
Date:
Subject: Re: Truncation of char, varchar types