Re: How to make silently truncate for char type - Mailing list pgsql-general

From Aasmund Midttun Godal
Subject Re: How to make silently truncate for char type
Date
Msg-id E18LCYV-00065L-00@mail.krot.org
Whole thread Raw
In response to How to make silently truncate for char type  (Terence Leung <tcmleung@yahoo.com>)
Responses functions + shared libraries  (Eric B.Ridge <ebr@tcdi.com>)
List pgsql-general
Creating a rule/trigger (before insert) with the appropriate substr
function would, I imagine, do the trick.

Regards,

Aasmund

* Terence Leung <tcmleung@yahoo.com> wrote:
> 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@postgresql.org so that your
> message can get through to the mailing list cleanly
>

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46 - Elgesetergt. 26B, N-7030 Trondheim

pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: UPDATE syntax problem
Next
From: Hiroshi Inoue
Date:
Subject: Re: 7.3 no longer using indexes for LIKE queries