Re: value too long error

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Rajat Katyal <rajatk(at)intelesoftech(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: value too long error
Date: 2004-03-01 16:01:00
Message-ID: Pine.LNX.4.33.0403010859450.32148-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 28 Feb 2004, Rajat Katyal wrote:

> Hi:
>
> Whenever i try to insert the data, size of which is greater than that of column datatype size, I got the exception value too long for.....
>
> However this was not in postgresql7.2.
>
> Can anyone please tell me, is there any way so that i wont get this exception. Please help me as soon as possible

As mentioned earlier, this is against spec (and for good reason,
databases, by default, shouldn't just toss away data that doesn't fit,
they should throw an error and prevent accidental data loss.)

That said, the easiest way to do this is to make the field a text type,
not a limited varchar, then create a before trigger that uses substring to
chop all but the first x characters and insert them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2004-03-01 16:09:58 Re: md5 calls
Previous Message Thomas Beutin 2004-03-01 16:00:31 Re: ORDER BY problem