pg_dumpall bug in PG 8.0b3 Win32 port

Started by Luiz K. Matsumuraover 21 years ago8 messagesbugs
Jump to latest
#1Luiz K. Matsumura
luiz@planit.com.br

Hi,

I tried to use pg_dumpall in Win32 and receive a error message like this:

pg_dump.exe: [archiver (db)] connection to database "test" failed:
FATAL: user "'postgres'" does not exist

Well, the word "'postgres'" is the word is between simple quotations
marks and later between double quotations marks.
Then, I assume that the error must be in string that pg_dumpall mounts
to execute pg_dump

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports
But, I don't have how to test it.
Please, somebody can test and fix the pg_dumpall.c of oficial source ?

Thanks in advance

Luiz

Attachments:

pg_dumpall.ctext/plain; name=pg_dumpall.cDownload
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Luiz K. Matsumura (#1)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Luiz K. Matsumura wrote:

Hi,

I tried to use pg_dumpall in Win32 and receive a error message like
this:

pg_dump.exe: [archiver (db)] connection to database "test" failed:
FATAL: user "'postgres'" does not exist

Well, the word "'postgres'" is the word is between simple quotations
marks and later between double quotations marks.
Then, I assume that the error must be in string that pg_dumpall mounts
to execute pg_dump

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports
But, I don't have how to test it.
Please, somebody can test and fix the pg_dumpall.c of oficial source ?

Thanks in advance

Luiz

Please provide your patch as a context diff, not as the whole file, so
we can see what is changed.

cheers

andrew

#3Luiz K. Matsumura
luiz@planit.com.br
In reply to: Andrew Dunstan (#2)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Andrew Dunstan wrote:

Luiz K. Matsumura wrote:

Hi,

I tried to use pg_dumpall in Win32 and receive a error message like
this:

pg_dump.exe: [archiver (db)] connection to database "test" failed:
FATAL: user "'postgres'" does not exist

Well, the word "'postgres'" is the word is between simple quotations
marks and later between double quotations marks.
Then, I assume that the error must be in string that pg_dumpall mounts
to execute pg_dump

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports
But, I don't have how to test it.
Please, somebody can test and fix the pg_dumpall.c of oficial source ?

Thanks in advance

Luiz

Please provide your patch as a context diff, not as the whole file, so
we can see what is changed.

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Ops, excuse-me. I'm a novice.

Attachments:

pg_dumpall.c.difftext/plain; name=pg_dumpall.c.diffDownload+0-19
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Luiz K. Matsumura (#3)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

"Luiz K. Matsumura" <luiz@planit.com.br> writes:

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports

This seems unnecessarily ugly. Why not just go over to double quotes?

regards, tom lane

#5Bruce Momjian
bruce@momjian.us
In reply to: Luiz K. Matsumura (#3)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Patch applied. Thanks.

---------------------------------------------------------------------------

Luiz K. Matsumura wrote:

Andrew Dunstan wrote:

Luiz K. Matsumura wrote:

Hi,

I tried to use pg_dumpall in Win32 and receive a error message like
this:

pg_dump.exe: [archiver (db)] connection to database "test" failed:
FATAL: user "'postgres'" does not exist

Well, the word "'postgres'" is the word is between simple quotations
marks and later between double quotations marks.
Then, I assume that the error must be in string that pg_dumpall mounts
to execute pg_dump

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports
But, I don't have how to test it.
Please, somebody can test and fix the pg_dumpall.c of oficial source ?

Thanks in advance

Luiz

Please provide your patch as a context diff, not as the whole file, so
we can see what is changed.

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Ops, excuse-me. I'm a novice.

*** pg_dumpall.c	Tue Oct  5 18:53:27 2004
--- pg_dumpall.c.ori	Tue Oct  5 21:59:42 2004
***************
*** 180,195 ****

case 'h':
pghost = optarg;
- #ifndef WIN32
appendPQExpBuffer(pgdumpopts, " -h '%s'", pghost);
- #else
- appendPQExpBuffer(pgdumpopts, " -h \"%s\"", pghost);
- #endif
-
break;

- 
- 
case 'i':
case 'o':
appendPQExpBuffer(pgdumpopts, " -%c", c);
--- 180,188 ----
***************
*** 201,211 ****

case 'p':
pgport = optarg;
- #ifndef WIN32
appendPQExpBuffer(pgdumpopts, " -p '%s'", pgport);
- #else
- appendPQExpBuffer(pgdumpopts, " -p \"%s\"", pgport);
- #endif
break;

case 's':
--- 194,200 ----
***************
*** 214,233 ****
break;

case 'S':
- #ifndef WIN32
appendPQExpBuffer(pgdumpopts, " -S '%s'", optarg);
- #else
- appendPQExpBuffer(pgdumpopts, " -S \"%s\"", optarg);
- #endif
break;

case 'U':
pguser = optarg;
- #ifndef WIN32
appendPQExpBuffer(pgdumpopts, " -U '%s'", pguser);
- #else
- appendPQExpBuffer(pgdumpopts, " -U \"%s\"", pguser);
- #endif
break;

case 'v':
--- 203,214 ----

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Tom Lane wrote:

"Luiz K. Matsumura" <luiz@planit.com.br> writes:

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports

This seems unnecessarily ugly. Why not just go over to double quotes?

The patch was actually posted backward so maybe it wasn't clear but the
change is to use double quotes instead of single quotes for Win32
arguments just like we do in other cases in pg_dumpall.c.

Single quotes do not behave the same as single quotes in the WIn32
CMD.EXES processor. For example, DIR "" and DIR '' produce different
results.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7Andrew Dunstan
andrew@dunslane.net
In reply to: Bruce Momjian (#6)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Bruce Momjian wrote:

Tom Lane wrote:

"Luiz K. Matsumura" <luiz@planit.com.br> writes:

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports

This seems unnecessarily ugly. Why not just go over to double quotes?

The patch was actually posted backward so maybe it wasn't clear but the
change is to use double quotes instead of single quotes for Win32
arguments just like we do in other cases in pg_dumpall.c.

Single quotes do not behave the same as single quotes in the WIn32
CMD.EXES processor. For example, DIR "" and DIR '' produce different
results.

Yes, but wasn't Tom's point that we could use double quotes on Unix too?
That makes sense to me unless we expect some horrible interpolation effects.

cheers

andrew

#8Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#7)
Re: pg_dumpall bug in PG 8.0b3 Win32 port

Andrew Dunstan wrote:

Bruce Momjian wrote:

Tom Lane wrote:

"Luiz K. Matsumura" <luiz@planit.com.br> writes:

I modified pg_dumpall.c lines between 160 and 270 to add a #ifndef
WIN32... #endif clause to pgdumpopts to store
the parameters with double quotations intead simple quotation marks in
case of WIN32 ports

This seems unnecessarily ugly. Why not just go over to double quotes?

The patch was actually posted backward so maybe it wasn't clear but the
change is to use double quotes instead of single quotes for Win32
arguments just like we do in other cases in pg_dumpall.c.

Single quotes do not behave the same as single quotes in the WIn32
CMD.EXES processor. For example, DIR "" and DIR '' produce different
results.

Yes, but wasn't Tom's point that we could use double quotes on Unix too?
That makes sense to me unless we expect some horrible interpolation effects.

Oh, OK. Well, if we use double-quotes we don't allow double-quotes in
the input, as well adding handling of dollar signs and other things.
Single quotes are more robust under Unix and I don't want to risk
changing that.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073