Thread: Panic - Format has changed

Panic - Format has changed

From
Glen Eustace
Date:
Hi,

last night we upgraded our primary web server, which included upgrading
postgres to 7.2.1

A rather unexpected change in behaviour has broken one of our
applications.

We have a column containing a varchar array. This used to be displayed
with all the elements quoted, seperated by commas i.e.
{ "a","b","c","d" }

Now, the quotes are only present if the element includes a quote or a
space. i.e.
{ a,"b b",c,d }

This is much more difficult to parse and will involve lots of code
changes in our application.  Is there ANY setting I can change that will
result in the data being displayed as before.

--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen and Rosanne Eustace,
GodZone Internet Services, a division of AGRE Enterprises Ltd.,
P.O. Box 8020, Palmerston North, New Zealand 5301
Ph/Fax: +64 6 357 8168, Mob: +64 21 424 015



Re: Panic - Format has changed

From
Jeff Davis
Date:
My best suggestion offhand is to create a plpgsql function that returns text
and make it loop through the array and output in the format that you're used
to. Then change you select statements from:
"select a,b,c from mytable;"
to:
"select a,myfunction(b),c from mytable;"
where b is the varchar array attribute.

I don't think that was the answer you were looking for, but it's the best I
could think of right now.

It can be very troublesome to deal with upgrades when changes like that aren't
mentioned in the migration notes.

Regards,
    Jeff

On Friday 13 September 2002 01:47 pm, Glen Eustace wrote:
> Hi,
>
> last night we upgraded our primary web server, which included upgrading
> postgres to 7.2.1
>
> A rather unexpected change in behaviour has broken one of our
> applications.
>
> We have a column containing a varchar array. This used to be displayed
> with all the elements quoted, seperated by commas i.e.
> { "a","b","c","d" }
>
> Now, the quotes are only present if the element includes a quote or a
> space. i.e.
> { a,"b b",c,d }
>
> This is much more difficult to parse and will involve lots of code
> changes in our application.  Is there ANY setting I can change that will
> result in the data being displayed as before.


Re: Panic - Format has changed

From
Glen Eustace
Date:
Thanks Jeff, no, not the answer I was looking for but may be the solution I have to use.

I have brought the pre7.2 database back up on another server,
temporarilly, in the hope that someone else has a potential solution.

No one has indicated whether posgres has a SET or similiar to change
back to the pre-7.2 array element delimiting behaviour.

Has anyone already written a PHP code snippet for splitting a CSV
string, as now produced by postgresql, into an array of varchars ?

--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen and Rosanne Eustace,
GodZone Internet Services, a division of AGRE Enterprises Ltd.,
P.O. Box 8020, Palmerston North, New Zealand 5301
Ph/Fax: +64 6 357 8168, Mob: +64 21 424 015



Re: Panic - Format has changed

From
Elaine Lindelef
Date:
>Thanks Jeff, no, not the answer I was looking for but may be the
>solution I have to use.
>
>I have brought the pre7.2 database back up on another server,
>temporarilly, in the hope that someone else has a potential solution.
>
>No one has indicated whether posgres has a SET or similiar to change
>back to the pre-7.2 array element delimiting behaviour.
>
>Has anyone already written a PHP code snippet for splitting a CSV
>string, as now produced by postgresql, into an array of varchars ?
>
>--

You might look for code snippets related to Excel, also, since this
bit of regrettable behavior is now the Microsoft Way.

I am CERTAIN someone has written some code to deal with it.

Elaine Lindelef


Re: Panic - Format has changed

From
Glen Eustace
Date:
Unfortunately not.  That reads from a file.  I have a string :-(

I am playing around with a perl regex and preg_match_all but it is NOT
trivial.

On Tue, 2002-09-17 at 11:14, Ron Snyder wrote:
> > >Has anyone already written a PHP code snippet for splitting a CSV
> > >string, as now produced by postgresql, into an array of varchars ?
>
> You mean something like this:
> http://www.php.net/manual/en/function.fgetcsv.php
>
> -ron
>
--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen and Rosanne Eustace,
GodZone Internet Services, a division of AGRE Enterprises Ltd.,
P.O. Box 8020, Palmerston North, New Zealand 5301
Ph/Fax: +64 6 357 8168, Mob: +64 21 424 015