On Wed, Sep 5, 2012 at 04:22:18PM -0400, Andrew Dunstan wrote:
> >>So, right now we are only add \r for function bodies, which is mostly
> >>harmless, but what if a function body has strings with an embedded
> >>newlines? What about creating a table with newlines in its identifiers:
> >>
> >>CREATE TABLE "a
> >>b" ("c
> >>d" int);
> >>
> >>If \r is added in there, it would be a data corruption problem. Can you
> >>test that?
> >
> >These are among the reasons why I am suggesting opening the file
> >in binary mode. You're right, that would be data corruption.
> >
> >I can set up a check, but it will take a bit of time.
>
>
> As expected, we get a difference in field names. Here's the extract
> from the dumps diff (* again represents CR):
>
>
> ***************
> *** 5220,5228 ****
> --
>
> CREATE TABLE hasnewline (
> ! "x
> y" integer,
> ! "a
> b" text
> );
>
> --- 5220,5228 ----
> --
>
> CREATE TABLE hasnewline (
> ! "x*
> y" integer,
> ! "a*
> b" text
> );
>
> If we open the input and output files in binary mode in pg_upgrade's
> dump.c this disappears.
>
> Given this, I think we have no choice but to apply the patch, all
> the way back to 9.0 in fact.
I think you are right.
I think I could use some "quite time" right now, as Tom suggested. ;-)
-- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB
http://enterprisedb.com
+ It's impossible for everything to be true. +