Re: postgres 9.2 error whit apostrophes

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "alejandrob(at)pasteleros(dot)org(dot)ar" <alejandrob(at)pasteleros(dot)org(dot)ar>, "posgres support" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgres 9.2 error whit apostrophes
Date: 2013-06-12 07:03:54
Message-ID: A737B7A37273E048B164557ADEF4A58B17BB21BE@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Alejandro Brust wrote:
> we recently move from pg9.0 to pg 9.2 whit this method:
>
> from a new server PG9.2 we did:
> pg_dump -h server -p 5432 -U user -Fc -i -b base-name > bk.backup
>
> after that in the new server
> createdb -T template0 -E LATIN1 basename
> pg_restore -h server -p 5432 -U user -d basename bk.backup
>
> now we are having problems with updates on tables whit apostrophes like >> o'higgins << on any
> character fields
> First question:
> is there any configurable parameter for PG9.2 that make
> update tu02t00 set tu02pfusua = 'D'AGOSTINO' work...
> the server error said
>
> ERROR: syntax error at or near "AGOSTINO" at character 187
>
> Second question:
> If there is no way to configure PG9.2 to accept this Cain of update
> which is the best method to do a downgrade from 9.2 to 9.0 (we are not using any new function)

This statement didn't work in any version of PostgreSQL.

I'm guessing that the statement really was:
UPDATE tu02t00 SET tu02pfusua = 'D\'AGOSTINO'
(notice the backslash).

That would have worked in PostgreSQL 9.0 with default configuration
(and given you a warning), but won't work with PostgreSQL 9.2.

If that is your problem, you can set standard_confirming_strings = off
to restore the old behaviour.

It would be much better, though, to adapt your program to use
standard conforming strings, like this:
UPDATE tu02t00 SET tu02pfusua = 'D''AGOSTINO'

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message K P Manoj 2013-06-13 07:49:55 pgsql-admin@postgresql.org, K P Manoj has invited you to open a Gmail account
Previous Message David Johnston 2013-06-11 23:08:46 Re: postgres 9.2 error whit apostrophes