Re: 7.2 changes to varchar truncation

From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <jwbaker(at)acm(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: 7.2 changes to varchar truncation
Date: 2002-01-07 18:54:48
Message-ID: sc397ea3.010@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This brings up an interesting question, is there a reason to specify n? In other words, what is the downside of VARCHAR compared to VARCHAR(n)? I will have the same problem soon, so I may change all of mine to plain old VARCHAR now if it makes sense...

Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: iharding(at)tpchd(dot)org

>>> "Jeffrey W. Baker" <jwbaker(at)acm(dot)org> 12/31/01 02:04PM >>>
Given a column of type varchar(n), postgres 7.1 allowed me to insert a
string s of length m where m > n by truncating s. In 7.2, I get an error:
ERROR: value too long for type character varying(64). This is annoying
and breaks practically all of my programs. The fact that this is
mentioned in the docs doesn't make this suck less.

What do I do to get back the old behavior?

If I have to change my datatypes to text or varchar without a limit, I'll
have to drop and reload my databases (again), about which I plan to have a
real bad attitude.

-jwb

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jon Lapham 2002-01-07 19:16:54 Re: How to cast a char[] to varchar?
Previous Message Tom Lane 2002-01-07 18:50:16 Re: How to cast a char[] to varchar?