From: | Jan Wieck <janwieck(at)yahoo(dot)com> |
---|---|
To: | Neil Conway <nconway(at)klamath(dot)dyndns(dot)org> |
Cc: | Doug Fields <dfields-pg-general(at)pexicom(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: ERROR: value too long for type character varying(255) |
Date: | 2002-05-22 02:42:52 |
Message-ID: | 200205220242.g4M2grd01627@saturn.janwieck.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Neil Conway wrote:
> On Tue, 21 May 2002 12:17:38 -0400
> "Doug Fields" <dfields-pg-general(at)pexicom(dot)com> wrote:
> > In PG 7.1.3, ISTR I used to be able to submit any length I wished for a
> > VARCHAR (and maybe a CHAR).
> >
> > Now, I'm at 7.2.1 and get these errors:
> >
> > ERROR: value too long for type character varying(255)
> >
> > as JDBC Exceptions.
> >
> > Do you know how I can tell it to "silently truncate" the data as I believe
> > it used to?
>
> Is there a reason you can't just use TEXT? It will be stored the same
> internally...
>
> But the most obvious way I can think of to do what you're asking is
> to define a rule to replace the value inserted with a call to
> substring().
And exactly that will fail because the rewritten query will
be of the same operation type on the same table, triggering
the same rule again ...
The way I see is to use TEXT or VARCHAR without a size limit,
and defining a custom BEFORE trigger that truncates the NEW
value.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Beck | 2002-05-22 03:14:49 | psql -l gives bad output |
Previous Message | Victor Manuel Torres Aguirre | 2002-05-22 00:50:14 | PostgreSQL+Access97+Linux: How to.. |