Thread: bug in pg_dump

bug in pg_dump

From
Kilian Koepsell
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        :Kilian Koepsell
Your email address    :kilian.koepsell


System Configuration
---------------------
  Architecture (example: Intel Pentium)      : Intel Pentium II

  Operating System (example: Linux 2.0.26 ELF)     :  both Linux 2.2.5
                                                   and  DEC OSF/1

  PostgreSQL version (example: PostgreSQL-6.5)  :   PostgreSQL-6.5

  Compiler used (example:  gcc 2.8.0)        :  both gcc 2.7.2.3
                                                   and  DEC cc

Please enter a FULL description of your problem:
------------------------------------------------
If You have a database field containing
    Jos\'e
the command pgdump -D gives the value
    Jos''e

In Version PostgreSQL-6.3 You got something like
    Jos\\\'\'e

Best regards,
  Kilian Koepsell




Re: [BUGS] bug in pg_dump

From
Tom Lane
Date:
Kilian Koepsell <koepsell@aei-potsdam.mpg.de> writes:
> If You have a database field containing
>     Jos\'e
> the command pgdump -D gives the value
>     Jos''e

I cannot reproduce this here --- I get Jos\\''e which is what the
pg_dump code is supposed to do...

Are you perchance using a multibyte encoding, and if so which one?

            regards, tom lane

Re: [BUGS] bug in pg_dump

From
Kilian Koepsell
Date:
> Kilian Koepsell <koepsell@aei-potsdam.mpg.de> writes:
> > If You have a database field containing
> >     Jos\'e
> > the command pgdump -D gives the value
> >     Jos''e
>
> I cannot reproduce this here --- I get Jos\\''e which is what the
> pg_dump code is supposed to do...
>

Oh, you are right. I checked it again and I also got Jos\\''e.
But I expected to get Jos\\\' (a quoted \ -> \\ and a quoted ' -> \').
Is '' an other possibility to quote the ' character?

regards,
  Kilian


Re: [BUGS] bug in pg_dump

From
Tom Lane
Date:
Kilian Koepsell <koepsell@aei-potsdam.mpg.de> writes:
>> I cannot reproduce this here --- I get Jos\\''e which is what the
>> pg_dump code is supposed to do...

> Oh, you are right. I checked it again and I also got Jos\\''e.
> But I expected to get Jos\\\' (a quoted \ -> \\ and a quoted ' -> \').
> Is '' an other possibility to quote the ' character?

Yes, in fact it is the SQL-standard-approved way.  \' is not standard.
pg_dump used to use \', but I changed it to use '' in hopes of improving
compatibility with other RDBMSes.

BTW, now that I look at the code I think that it may have a bug in the
MULTIBYTE case, since pg_dump will be dealing with client-side encodings
but it is not doing anything special to handle multibyte characters.
Can any multibyte guru comment on whether it is OK or not?

            regards, tom lane