Re: How to make silently truncate for char type

From: "Daniel Morgan" <danmorg(at)sc(dot)rr(dot)com>
To: "Terence Leung" <tcmleung(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to make silently truncate for char type
Date: 2002-12-08 12:19:13
Message-ID: JEEKLEDOLGOLOABENDFBAEJFCNAA.danmorg@sc.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Actually, I consider it normal behavior of a database to have an error if
the
data value length is greater than the defined length. If it needs to be
truncated, you do
the truncate before you insert into the table. This is the way it works on
enterprise databases like Oracle. Maybe it was a bug in 7.1 that
automatically truncated for you. I don't know for sure as I only have 7.2
installed.

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Terence Leung
Sent: Sunday, December 08, 2002 7:02 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] How to make silently truncate for char type

I upgraded postgresql 7.1 to 7.2 and found that many
sql cannot execute because version 7.2 does not
silently truncate the string for char(n) type during
insert a new row.
e.g. insert t (field1) value ('abcdef');
where field1 is char(5) but I insert the string
has 6 characters.

How can I solve the problem except downgrade the
Postgresql?

Looking forward to your reply!!!

=====
Yours sincerely,
Leung Chun Man, Terence

Mobile: (852) 9273 9176
Homepage: http://tcmleung.uhome.net ,
http://www.dynamicdrive.com/dynamicindex4/filter/index.htm

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pginfo 2002-12-08 12:21:42 pg 7.3 memory error
Previous Message Terence Leung 2002-12-08 12:01:54 How to make silently truncate for char type