Re: character varying array bug in 7.4.1 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: character varying array bug in 7.4.1
Date
Msg-id 16145.1073598079@sss.pgh.pa.us
Whole thread Raw
In response to character varying array bug in 7.4.1  ("Esh, Andrew" <Andrew_Esh@adaptec.com>)
List pgsql-bugs
"Esh, Andrew" <Andrew_Esh@adaptec.com> writes:
> I upgraded from 7.1beta5 to 7.4.1 recently, and I noticed that many of
> my character varying arrays were getting a trailing space inserted
> into their last value. This appears to be the result of white space
> being misplaced during the INSERT/UPDATE command. If there is a space
> before the close-curly-brace, it gets appended to the last quoted
> value.

It's been that way since 7.2, and was intentional.  IIRC, the array
parser's behavior in 7.1 and before was inconsistent across datatypes,
and we concluded this was the closest we could get to backwards
compatibility while still having something moderately sane.  It is
documented:

    You may write whitespace before a left brace, after a right
    brace, or before any individual item string. Whitespace after an
    item is not ignored, however: after skipping leading whitespace,
    everything up to the next right brace or delimiter is taken as
    the item value.

See http://www.postgresql.org/docs/7.4/static/arrays.html#AEN5228

            regards, tom lane

pgsql-bugs by date:

Previous
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1045: hostname lookup in psql or libpg.sl does work
Next
From: Guy Thornley
Date:
Subject: Re: Crash while recovering database index relation