Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-24 Thread Magnus Hagander
Andrew Dunstan wrote: > > > Tom Lane wrote: >>> The point being that the config files are opened with AllocateFile(), >>> which in turn calls fopen(). It doesn't use open(). The proposal was >>> only to make all *open()* calls do it binary. I was under the impression >>> that on Unix, that's what

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-24 Thread Andrew Dunstan
Tom Lane wrote: The point being that the config files are opened with AllocateFile(), which in turn calls fopen(). It doesn't use open(). The proposal was only to make all *open()* calls do it binary. I was under the impression that on Unix, that's what open() did, so we should behave the same?

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-24 Thread Tom Lane
Magnus Hagander <[EMAIL PROTECTED]> writes: > Andrew Dunstan wrote: >> Tom Lane wrote: >>> If you need a positive reason why this might be a bad idea, consider the >>> idea that someone is examining postgresql.conf with a text editor that >>> stops reading at control-Z. He might not be able to see

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-24 Thread Magnus Hagander
Magnus Hagander wrote: > Andrew Dunstan wrote: >> >> Tom Lane wrote: >>> Bruce Momjian <[EMAIL PROTECTED]> writes: >>> Tom Lane wrote: > Well, why is that a bug? If the platform is so silly as to define text > files that way, who are we to argue? > >>> The

Re: [HACKERS] 0x1A in control file on Windows

2008-09-23 Thread Magnus Hagander
Andrew Dunstan wrote: > > > Tom Lane wrote: >> Bruce Momjian <[EMAIL PROTECTED]> writes: >> >>> Tom Lane wrote: >>> Well, why is that a bug? If the platform is so silly as to define text files that way, who are we to argue? >> >> >>> The problem is that our pg_contr

Re: [HACKERS] 0x1A in control file on Windows

2008-09-23 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> pg_controldata is certainly already being read as binary. > Umm, no, it is in the backend I believe but not in the utilities. Hence > the original bug report. We need to add the binary flag in > pg_controldata.c and pg_resetxlog.c.

Re: [HACKERS] 0x1A in control file on Windows

2008-09-23 Thread Andrew Dunstan
Tom Lane wrote: Bruce Momjian <[EMAIL PROTECTED]> writes: Tom Lane wrote: Well, why is that a bug? If the platform is so silly as to define text files that way, who are we to argue? The problem is that our pg_controldata might have binary values that contain 0x1a that wi

Re: [HACKERS] 0x1A in control file on Windows

2008-09-23 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Well, why is that a bug? If the platform is so silly as to define text >> files that way, who are we to argue? > The problem is that our pg_controldata might have binary values that > contain 0x1a that will be confused by the operatin

Re: [HACKERS] 0x1A in control file on Windows

2008-09-23 Thread Bruce Momjian
Tom Lane wrote: > ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: > > I found a bug that pg_controldata ends with error if control files > > contain 0x1A (Ctrl+Z) on Windows. > > > We probably need to add PG_BINARY when we open control files > > because 0x1A is an end-of-file marker on Windows. > >

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-19 Thread Magnus Hagander
Andrew Dunstan wrote: > > > Magnus Hagander wrote: >> I had a chat with Heikki about this, and the proper way to fix it. >> >> Should there actually be any reason not to *always* open our files with >> O_BINARY? That seems to be what should mimic what Unix does, which would >> be what we expect,

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-19 Thread Andrew Dunstan
Magnus Hagander wrote: I had a chat with Heikki about this, and the proper way to fix it. Should there actually be any reason not to *always* open our files with O_BINARY? That seems to be what should mimic what Unix does, which would be what we expect, no? If that is so, then I propose we do

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-19 Thread Magnus Hagander
Magnus Hagander wrote: > Heikki Linnakangas wrote: >> ITAGAKI Takahiro wrote: >>> Tom Lane <[EMAIL PROTECTED]> wrote: >>> ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: > We probably need to add PG_BINARY when we open control files > because 0x1A is an end-of-file marker on Windows.

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-18 Thread Magnus Hagander
Heikki Linnakangas wrote: > ITAGAKI Takahiro wrote: >> Tom Lane <[EMAIL PROTECTED]> wrote: >> >>> ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: We probably need to add PG_BINARY when we open control files because 0x1A is an end-of-file marker on Windows. >>> Well, why is that a bug? If th

Re: [BUGS] [HACKERS] 0x1A in control file on Windows

2008-09-18 Thread Heikki Linnakangas
ITAGAKI Takahiro wrote: Tom Lane <[EMAIL PROTECTED]> wrote: ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: We probably need to add PG_BINARY when we open control files because 0x1A is an end-of-file marker on Windows. Well, why is that a bug? If the platform is so silly as to define text files

Re: [HACKERS] 0x1A in control file on Windows

2008-09-17 Thread ITAGAKI Takahiro
Tom Lane <[EMAIL PROTECTED]> wrote: > ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: > > We probably need to add PG_BINARY when we open control files > > because 0x1A is an end-of-file marker on Windows. > > Well, why is that a bug? If the platform is so silly as to define text > files that way,

Re: [HACKERS] 0x1A in control file on Windows

2008-09-17 Thread Tom Lane
ITAGAKI Takahiro <[EMAIL PROTECTED]> writes: > I found a bug that pg_controldata ends with error if control files > contain 0x1A (Ctrl+Z) on Windows. > We probably need to add PG_BINARY when we open control files > because 0x1A is an end-of-file marker on Windows. Well, why is that a bug? If the

[HACKERS] 0x1A in control file on Windows

2008-09-17 Thread ITAGAKI Takahiro
I found a bug that pg_controldata ends with error if control files contain 0x1A (Ctrl+Z) on Windows. We probably need to add PG_BINARY when we open control files because 0x1A is an end-of-file marker on Windows. This fix needs to be applied in back versions (8.2, 8.3 and HEAD). Index: src/bin/pg