X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 050E65E46D9 for ; Fri, 13 Aug 2004 01:32:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28267-07 for ; Fri, 13 Aug 2004 04:32:48 +0000 (GMT) Received: from mammoth.utopiasystems.net (meridian1.utopiasystems.net [66.150.45.40]) by svr1.postgresql.org (Postfix) with ESMTP id 99ED05E46D8 for ; Fri, 13 Aug 2004 01:32:39 -0300 (ADT) Received: from [192.168.1.100] ([67.173.111.107]) by mammoth.utopiasystems.net with Microsoft SMTPSVC(6.0.3790.0); Fri, 13 Aug 2004 00:31:09 -0400 User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Thu, 12 Aug 2004 23:32:41 -0500 Subject: Re: PG 7.2 varchar change From: Steve Lane To: Cc: Jamie Thomas Message-ID: In-Reply-To: <17798.1092369431@sss.pgh.pa.us> Mime-version: 1.0 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable X-OriginalArrivalTime: 13 Aug 2004 04:31:09.0656 (UTC) FILETIME=[5B5C3D80:01C480EE] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_RFCI X-Spam-Level: X-Archive-Number: 200408/107 X-Sequence-Number: 14502 Thanks, Tom, that's very helpful. One more clarification: if the underlying column has no express length limit (for example, it was defined as type 'text'), is this issue moot? -- sgl > From: Tom Lane > Date: Thu, 12 Aug 2004 23:57:11 -0400 > To: slane > Cc: pgsql-admin@postgresql.org, Jamie Thomas > Subject: Re: [ADMIN] PG 7.2 varchar change >=20 > slane writes: >> Here=B9s the currently most alarming, a change that is recorded for 7.2: >> CHAR(), VARCHAR() now reject strings that are too long (Peter E) >> What does this mean? Or how do I find out what it means? >=20 > If in doubt, experiment. >=20 > In 7.1: >=20 > regression=3D# create table foo(f1 varchar(5)); > CREATE > regression=3D# insert into foo values('1234567890'); > INSERT 2913462 1 > regression=3D# select * from foo; > f1=20=20=20 > ------- > 12345 > (1 row) >=20 > In 7.4: >=20 > regression=3D# create table foo(f1 varchar(5)); > CREATE TABLE > regression=3D# insert into foo values('1234567890'); > ERROR: value too long for type character varying(5) >=20 > 7.4 follows the SQL spec (or our current understanding of it anyway): > strings will not be silently truncated. If you want to force truncation > to a particular length you can cast the string explicitly: >=20 > regression=3D# select 'way too long'::varchar(5); > varchar=20 > --------- > way t > (1 row) >=20 > That works the same in either version. >=20 > regards, tom lane >=20