Re: How to make silently truncate for char type

From: Aasmund Midttun Godal <postgresql(at)aasmund(dot)com>
To: tcmleung(at)yahoo(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to make silently truncate for char type
Date: 2002-12-09 01:17:55
Message-ID: E18LCYV-00065L-00@mail.krot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Creating a rule/trigger (before insert) with the appropriate substr
function would, I imagine, do the trick.

Regards,

Aasmund

* Terence Leung <tcmleung(at)yahoo(dot)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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

Aasmund Midttun Godal

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Inoue 2002-12-09 01:37:40 Re: 7.3 no longer using indexes for LIKE queries
Previous Message Doug McNaught 2002-12-09 01:16:33 Re: UPDATE syntax problem