Thread: strangeness in pg_dump
Hi I have 2 servers, a linux and a freebsd, and I don't understand why when I dump on one, the dumped strings looks like : "foo\r\nbar" and on the other one : "foo^M\ bar" does someone have an idea of what compile time option is responsible for that ? -- Mathieu Arnold
> I have 2 servers, a linux and a freebsd, and I don't understand why when I > dump on one, the dumped strings looks like : > > "foo\r\nbar" > > and on the other one : > > "foo^M\ > bar" > > does someone have an idea of what compile time option is responsible for > that ? Perhaps this is a viewer-issue? Copy the fbsd one over to linux and view it again. Greetings, Bjoern
Mathieu Arnold wrote: > Hi > > I have 2 servers, a linux and a freebsd, and I don't understand why when I > dump on one, the dumped strings looks like : > > "foo\r\nbar" > > and on the other one : > > "foo^M\ > bar" > > does someone have an idea of what compile time option is responsible for > that ? Looks identical to me. ^M == \r == 0x0D == Carriage Return \ (at end of line) == \n == 0x0A == New Line Maybe you should use fully compatible commands to examine the data? Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
--On lundi 3 juin 2002 09:35 -0400 Jan Wieck <janwieck@yahoo.com> wrote: > Mathieu Arnold wrote: >> Hi >> >> I have 2 servers, a linux and a freebsd, and I don't understand why when >> I dump on one, the dumped strings looks like : >> >> "foo\r\nbar" >> >> and on the other one : >> >> "foo^M\ >> bar" >> >> does someone have an idea of what compile time option is responsible for >> that ? > > Looks identical to me. well, they do not I believe. > ^M == \r == 0x0D == Carriage Return > \ (at end of line) == \n == 0x0A == New Line that is right, but, in the first case, it is not '\r' + '\n' but '\\' + 'r' + '\\' + '\n' > Maybe you should use fully compatible commands to examine the > data? --On lundi 3 juin 2002 09:31 -0400 terry@greatgulfhomes.com wrote: > Are you sure the files are different format??? well, I use : pg_dump -c -h pgsqlhost -h file database on the 2 servers, the database being on another server... I don't understand. -- Mathieu Arnold
--On lundi 3 juin 2002 15:35 +0200 Bjoern Metzdorf <bm@turtle-entertainment.de> wrote: >> I have 2 servers, a linux and a freebsd, and I don't understand why when >> I dump on one, the dumped strings looks like : >> >> "foo\r\nbar" >> >> and on the other one : >> >> "foo^M\ >> bar" >> >> does someone have an idea of what compile time option is responsible for >> that ? > > Perhaps this is a viewer-issue? Copy the fbsd one over to linux and view > it again. no, no, it's really a psql issue, as copying the linux one on the freebsd box (viva binary compatibility) still does the same. -- Mathieu Arnold
Mathieu Arnold wrote: > > > --On lundi 3 juin 2002 09:35 -0400 Jan Wieck <janwieck@yahoo.com> wrote: > > > ^M == \r == 0x0D == Carriage Return > > \ (at end of line) == \n == 0x0A == New Line > > that is right, but, in the first case, it is not '\r' + '\n' but '\\' + 'r' > + '\\' + '\n' You're right. Shouldn't do anything before beeing done with at least my first coffee. Okay, need to look at the code in pg_dump the decides if to quote or not. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
--On lundi 3 juin 2002 10:08 -0400 Jan Wieck <janwieck@yahoo.com> wrote: > Mathieu Arnold wrote: >> >> >> --On lundi 3 juin 2002 09:35 -0400 Jan Wieck <janwieck@yahoo.com> wrote: >> >> > ^M == \r == 0x0D == Carriage Return >> > \ (at end of line) == \n == 0x0A == New Line >> >> that is right, but, in the first case, it is not '\r' + '\n' but '\\' + >> 'r' + '\\' + '\n' > > You're right. Shouldn't do anything before beeing done with > at least my first coffee. > > Okay, need to look at the code in pg_dump the decides if to > quote or not. that was what I was doing, but my grep "['\"]\\\\[rn]['\"]" was not helping me very much. -- Mathieu Arnold
Mathieu Arnold wrote: > > > --On lundi 3 juin 2002 10:08 -0400 Jan Wieck <janwieck@yahoo.com> wrote: > > > Okay, need to look at the code in pg_dump the decides if to > > quote or not. > > that was what I was doing, but my grep "['\"]\\\\[rn]['\"]" was not helping > me very much. I don't anything that could cause this in v7.2.1's pg_dump. Are the two servers running identical configurations (not only PG version, but multibyte support and encoding too)? For that matter, what version(s) are you running? Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
--On lundi 3 juin 2002 10:34 -0400 Jan Wieck <janwieck@yahoo.com> wrote: > Mathieu Arnold wrote: >> >> >> --On lundi 3 juin 2002 10:08 -0400 Jan Wieck <janwieck@yahoo.com> wrote: >> >> > Okay, need to look at the code in pg_dump the decides if to >> > quote or not. >> >> that was what I was doing, but my grep "['\"]\\\\[rn]['\"]" was not >> helping me very much. > > I don't anything that could cause this in v7.2.1's pg_dump. > Are the two servers running identical configurations (not > only PG version, but multibyte support and encoding too)? > > For that matter, what version(s) are you running? both have multibyte support, both encoding LATIN9 (france, euro) 7.2 on the linux, 7.2.1 on the freebsd -- Mathieu Arnold
Mathieu Arnold <mat@mat.cc> writes: >> For that matter, what version(s) are you running? > both have multibyte support, both encoding LATIN9 (france, euro) > 7.2 on the linux, 7.2.1 on the freebsd In that case I think the difference is explained by this 7.2.1 patch: 2002-02-12 16:25 tgl * doc/src/sgml/ref/copy.sgml, src/backend/commands/copy.c: Modify COPY TO to emit carriage returns and newlines as backslash escapes (backslash-r, backslash-n) for protection against newline-conversion munging. In future we will also tweak COPY FROM, but this part of the change should be backwards-compatible. Per pghackers discussion. Also, update COPY reference page to describe the backslash conversions more completely and accurately. regards, tom lane