Hi,
I need to backup my database with pg_dump and recover it in other
windows machine.
I recover my database running the pg_dump generated script in psql with
\i command
At each time I do this operation , misteriously the space between lines
multiplies in my functions and comments.
Well, I discover that when I use \i <file> command in psql with a file
generated in windows format ( CR+LF terminated lines) psql actually
sends the CR character at each line break to postgres, causing this effect.
I make a change in input.c that resolve this problem, but I'm not a
expert in c, therefore if someone have a better solution,
please do the necessary changes.
Thanks in advance.
*** input.c.ori 2005-03-09 21:05:36.000000000 -0300
--- input.c 2005-03-09 22:40:32.000000000 -0300
***************
*** 142,147 ****
--- 142,152 ----
if (buffer.data[buffer.len - 1] == '\n')
{
buffer.data[buffer.len - 1] = '\0';
+ /* in case of CR + LF */
+ if (buffer.data[buffer.len - 2] == '\r')
+ {
+ buffer.data[buffer.len - 2] = '\0';
+ }
return buffer.data;
}
}