Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Peter Eisentraut wrote: > >> Maybe instead we can change the COPY command to read the file directly and > >> not via stdin? Then we don't need the \. marker. > > I like that idea too. > > > Yes, we need a temp table then. The singl

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Jon Jensen writes: >> I hate to mention it, but would it be useful/non-overkill to make either >> of those things (context message maximum length and funny character >> escaping) configurable somehow? > I'm thinking the same. We have conflicting need

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Peter Eisentraut wrote: >> Maybe instead we can change the COPY command to read the file directly and >> not via stdin? Then we don't need the \. marker. I like that idea too. > Yes, we need a temp table then. The single-line fix seemed easier. Why a

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Alvaro Herrera
On Sat, Sep 27, 2003 at 01:08:37PM -0400, Bruce Momjian wrote: > Peter Eisentraut wrote: > > That is all besides the point. If adding -f to the command line is for > > some reason prohibitive, then the same applies to -e. That is all. > > Seems we should recommend -f rather than "<" for restore

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Bruce Momjian
Peter Eisentraut wrote: > Bruce Momjian writes: > > > OK, I have applied a patch to make initdb create a COPY file with > > consistent end-of-line termination, so it passes the COPY EOL checking. > > Maybe instead we can change the COPY command to read the file directly and > not via stdin? Then

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Bruce Momjian
Peter Eisentraut wrote: > Bruce Momjian writes: > > > You are assuming it is easy to find what is on a specific line of the > > dump file. I am not sure that is always easy for people with limited > > Unix skills, or MSWin folks. I am not sure I would have thought to add > > the file offset to f

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Peter Eisentraut
Bruce Momjian writes: > OK, I have applied a patch to make initdb create a COPY file with > consistent end-of-line termination, so it passes the COPY EOL checking. Maybe instead we can change the COPY command to read the file directly and not via stdin? Then we don't need the \. marker. -- Pet

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Peter Eisentraut
Bruce Momjian writes: > You are assuming it is easy to find what is on a specific line of the > dump file. I am not sure that is always easy for people with limited > Unix skills, or MSWin folks. I am not sure I would have thought to add > the file offset to find the problem COPY line. I guess

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Bruce Momjian
Peter Eisentraut wrote: > Oliver Elphick writes: > > > + > > + With a large dump, it may be difficult to identify where any errors are > > + occurring. You may use the -e option to psql to print the SQL commands > > + as they are run, so that it is easy to see precisely which comm

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Bruce Momjian
Bruce Momjian wrote: > Peter Eisentraut wrote: > > Tom Lane writes: > > > > > so it appears that cygwin's "echo" generates a different newline style > > > than what got put into sql_features.txt. A possible way to fix this is > > > to put the "\." line into sql_features.txt, but maybe there's a c

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Peter Eisentraut
Oliver Elphick writes: > + > + With a large dump, it may be difficult to identify where any errors are > + occurring. You may use the -e option to psql to print the SQL commands > + as they are run, so that it is easy to see precisely which commands are > + causing errors. >

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-27 Thread Peter Eisentraut
Jon Jensen writes: > I hate to mention it, but would it be useful/non-overkill to make either > of those things (context message maximum length and funny character > escaping) configurable somehow? I'm thinking the same. We have conflicting needs of different groups: Users on "real" Unix platfor

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Oliver Elphick
On Fri, 2003-09-26 at 23:18, Bruce Momjian wrote: > If you are loading from pg_dump, you have lots of copy commands, so how > do you know which COPY command caused the failure. You just have the > line number of _a_ copy. I would recommend using psql -e so that the sql commands are output too.

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Jon Jensen wrote: > On Fri, 26 Sep 2003, Tom Lane wrote: > > > I was chewing this over with Bruce on the phone just now, and we refined > > the idea a little. Some errors (primarily those detected inside the > > datatype input procedures) can be clearly traced to a specific column, > > whereas ot

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Jon Jensen
On Fri, 26 Sep 2003, Tom Lane wrote: > I was chewing this over with Bruce on the phone just now, and we refined > the idea a little. Some errors (primarily those detected inside the > datatype input procedures) can be clearly traced to a specific column, > whereas others (such as too many fields

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Peter Eisentraut wrote: > Tom Lane writes: > > > so it appears that cygwin's "echo" generates a different newline style > > than what got put into sql_features.txt. A possible way to fix this is > > to put the "\." line into sql_features.txt, but maybe there's a cleaner > > answer. Peter, any th

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: >> Minimalism isn't really a virtue in error reports anyway. >> I'm thinking maybe: >> CONTEXT: COPY tablename, line 41: "data ..." >> would serve the purpose nicely. > The only thing that would really help in the general case is the number of > the ch

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Peter Eisentraut wrote: > scott.marlowe writes: > > > table name too, like Bruce said. The bothersome bit is that in pg_dump, > > it says the line, relative to just this part of the copy command, so you > > don't even know which table is giving the error. > > I don't see the problem. Can't you

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Peter Eisentraut wrote: > Bruce Momjian writes: > > > The argument that you want a warning because you might have mixed > > newlines in the file seems less likely than this case where they are > > using a literal carriage return as a data value at the end of the line. > > I don't agree with that

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
Tom Lane writes: > This doesn't seem like a good argument not to add more information to > the CONTEXT line for COPY errors. Sure, in theory the existing info > should be sufficient, but what if the information is not coming in > through psql? (For instance, maybe the COPY data is being generate

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
I said: > The question isn't so much "who has CRs in their data" as "who is trying > to import data files in which CRs aren't correctly represented as \r" ? > Not anyone upgrading from a recent PG release ... though 7.1 or before > would have an issue. Actually, checking the CVS logs shows that 7.

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
scott.marlowe writes: > psql:webport.sql:803: ERROR: function "odbc_user" already exists with > same argument types > REVOKE > REVOKE > GRANT > You are now connected as new user "ayousuff". > psql:webport.sql:869: ERROR: literal newline found in data > HINT: Use "\n" to represent newline. > CON

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Bruce Momjian writes: >> The argument that you want a warning because you might have mixed >> newlines in the file seems less likely than this case where they are >> using a literal carriage return as a data value at the end of the line. > I don't agr

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Peter Eisentraut wrote: > scott.marlowe writes: > > > table name too, like Bruce said. The bothersome bit is that in pg_dump, > > it says the line, relative to just this part of the copy command, so you > > don't even know which table is giving the error. > > I don't see th

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > scott.marlowe writes: > >> but I get basically the same thing if I dump it to a .sql file and do: > >> psql dbname > > Use psql -f dbname.sql instead. > > This doesn't seem like a good argument not to add mo

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Peter Eisentraut wrote: > scott.marlowe writes: > > > but I get basically the same thing if I dump it to a .sql file and do: > > > > psql dbname > Use psql -f dbname.sql instead. and the output is: psql:webport.sql:803: ERROR: function "odbc_user" already exists with sa

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > scott.marlowe writes: >> but I get basically the same thing if I dump it to a .sql file and do: >> psql dbname Use psql -f dbname.sql instead. This doesn't seem like a good argument not to add more information to the CONTEXT line for COPY errors. Su

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Larry Rosenman
--On Friday, September 26, 2003 14:36:08 -0600 "scott.marlowe" <[EMAIL PROTECTED]> wrote: On Fri, 26 Sep 2003, Peter Eisentraut wrote: Bruce Momjian writes: > The argument that you want a warning because you might have mixed > newlines in the file seems less likely than this case where they a

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
scott.marlowe writes: > but I get basically the same thing if I dump it to a .sql file and do: > > psql dbname

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Peter Eisentraut wrote: > Bruce Momjian writes: > > > The argument that you want a warning because you might have mixed > > newlines in the file seems less likely than this case where they are > > using a literal carriage return as a data value at the end of the line. > > I

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
Bruce Momjian writes: > The argument that you want a warning because you might have mixed > newlines in the file seems less likely than this case where they are > using a literal carriage return as a data value at the end of the line. I don't agree with that assessment. Who actually has CRs in t

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
scott.marlowe writes: > table name too, like Bruce said. The bothersome bit is that in pg_dump, > it says the line, relative to just this part of the copy command, so you > don't even know which table is giving the error. I don't see the problem. Can't you identify the failing command by the li

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Bruce Momjian wrote: > scott.marlowe wrote: > > > OK, 'vi' shows it as: > > > > > > COPY people2 (id, persons) FROM stdin; > > > 59 Chance Terry--S > > > 60 ^M > > > \. > > > > > > which is _exactly the case the error was supposed to catch. Now, the > >

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Bruce Momjian wrote: > scott.marlowe wrote: > > > OK, 'vi' shows it as: > > > > > > COPY people2 (id, persons) FROM stdin; > > > 59 Chance Terry--S > > > 60 ^M > > > \. > > > > > > which is _exactly the case the error was supposed to catch. Now, the > >

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Michael Meskes
On Fri, Sep 26, 2003 at 03:05:58PM -0400, Tom Lane wrote: > Not sure if we should make the behavior Windows-specific though. And > didn't Michael report seeing the same initdb failure on Debian? That > confuses me a bit --- why would there be a newline discrepancy on Debian? I take it there are

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
scott.marlowe wrote: > > OK, 'vi' shows it as: > > > > COPY people2 (id, persons) FROM stdin; > > 59 Chance Terry--S > > 60 ^M > > \. > > > > which is _exactly the case the error was supposed to catch. Now, the > > big question is where did this dump come from? Pg

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Bruce Momjian wrote: > scott.marlowe wrote: > > The attached file produces this problem. Note it's a blank trailing field > > that looks to be causing it. The error for this .sql file is: > > > > ERROR: literal carriage return found in data > > HINT: Use "\r" to represen

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Bruce Momjian wrote: > scott.marlowe wrote: > > The attached file produces this problem. Note it's a blank trailing field > > that looks to be causing it. The error for this .sql file is: > > > > ERROR: literal carriage return found in data > > HINT: Use "\r" to represent carriage return. > >

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
scott.marlowe wrote: > The attached file produces this problem. Note it's a blank trailing field > that looks to be causing it. The error for this .sql file is: > > ERROR: literal carriage return found in data > HINT: Use "\r" to represent carriage return. > CONTEXT: COPY FROM, line 2 > > N

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Tom Lane wrote: > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > I'm running into issues where 7.4's pg_dump/pg_dumpall from a 7.2 database > > to a 7.4beta3 database is producing some errors like this: > > > ERROR: literal newline found in data > > HINT: Use "\n" to repr

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane writes: >> Yeah, I was wondering whether you wouldn't propose dropping the newline >> consistency check. I'm not very comfortable with that, but maybe we >> should. Bruce? > I don't mind if we keep it on pure-POSIX platforms. But one of th

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: > > ERROR: literal carriage return found in data > > HINT: Use "\r" to represent carriage return. > > CONTEXT: COPY FROM, line 41 > > Really? 7.2 should dump data \r or \n as the backslash versions ... > and does in my tests. Can you make a reproducible test case? > > > > >

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
"scott.marlowe" <[EMAIL PROTECTED]> writes: > I'm running into issues where 7.4's pg_dump/pg_dumpall from a 7.2 database > to a 7.4beta3 database is producing some errors like this: > ERROR: literal newline found in data > HINT: Use "\n" to represent newline. > CONTEXT: COPY FROM, line 59 > E

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread scott.marlowe
On Fri, 26 Sep 2003, Bruce Momjian wrote: > Tom Lane wrote: > > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > > Tom Lane writes: > > >> so it appears that cygwin's "echo" generates a different newline style > > >> than what got put into sql_features.txt. A possible way to fix this is > > >> to

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > ... we could add code to throw the WARNING > > only once per COPY command --- that would probably make sense. > > Seems like a bit of a kluge, but perhaps the best compromise. It would > be quite likely that you'd get the same warnin

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
Tom Lane writes: > Yeah, I was wondering whether you wouldn't propose dropping the newline > consistency check. I'm not very comfortable with that, but maybe we > should. Bruce? I don't mind if we keep it on pure-POSIX platforms. But one of the nicer developments on Windows in recent(?) times

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > ... we could add code to throw the WARNING > only once per COPY command --- that would probably make sense. Seems like a bit of a kluge, but perhaps the best compromise. It would be quite likely that you'd get the same warning on many lines of a COPY, a

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Peter Eisentraut wrote: > Tom Lane writes: > > > so it appears that cygwin's "echo" generates a different newline style > > than what got put into sql_features.txt. A possible way to fix this is > > to put the "\." line into sql_features.txt, but maybe there's a cleaner > > answer. Peter, any th

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Perhaps we can throw a warning rather than an error, and adjust initdb > > to be consistent. > > I like the idea of reducing the newline consistency check to a warning. > There is one thing we'd have to watch for though (it's already

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Andrew Dunstan wrote: > Bruce Momjian wrote: > > >I posted on that a few minutes ago. Yea, we can drop it, but we risk > >eating carraige returns as data values. I am not sure how consistently > >we output literal carriage returns in old dumps, nor how many apps > >produce on literal carriage re

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Perhaps we can throw a warning rather than an error, and adjust initdb > to be consistent. I like the idea of reducing the newline consistency check to a warning. There is one thing we'd have to watch for though (it's already an issue but would become a

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Andrew Dunstan
Bruce Momjian wrote: I posted on that a few minutes ago. Yea, we can drop it, but we risk eating carraige returns as data values. I am not sure how consistently we output literal carriage returns in old dumps, nor how many apps produce on literal carriage returns in COPY. If we conditionally eat

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Tom Lane writes: > >> so it appears that cygwin's "echo" generates a different newline style > >> than what got put into sql_features.txt. A possible way to fix this is > >> to put the "\." line into sql_features.txt, but maybe the

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane writes: >> so it appears that cygwin's "echo" generates a different newline style >> than what got put into sql_features.txt. A possible way to fix this is >> to put the "\." line into sql_features.txt, but maybe there's a cleaner >> answer.

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Bruce Momjian
Peter Eisentraut wrote: > Tom Lane writes: > > > so it appears that cygwin's "echo" generates a different newline style > > than what got put into sql_features.txt. A possible way to fix this is > > to put the "\." line into sql_features.txt, but maybe there's a cleaner > > answer. Peter, any th

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Peter Eisentraut
Tom Lane writes: > so it appears that cygwin's "echo" generates a different newline style > than what got put into sql_features.txt. A possible way to fix this is > to put the "\." line into sql_features.txt, but maybe there's a cleaner > answer. Peter, any thoughts? There's no clean answer to

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Michael Meskes
On Fri, Sep 26, 2003 at 11:01:34AM -0400, Tom Lane wrote: > > I am getting the error: > > " > > creating information schema... ERROR: end-of-copy marker does not match > > previous newline style > > CONTEXT: COPY FROM, line 361 > > " > > That's interesting. COPY is complaining because the \. t

Re: [HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Matthew T. O'Connor
On Fri, 2003-09-26 at 11:01, Tom Lane wrote: > so it appears that cygwin's "echo" generates a different newline style > than what got put into sql_features.txt. A possible way to fix this is > to put the "\." line into sql_features.txt, but maybe there's a cleaner > answer. Peter, any thoughts?

[HACKERS] initdb failure (was Re: [GENERAL] sequence's plpgsql)

2003-09-26 Thread Tom Lane
Tim McAuley <[EMAIL PROTECTED]> writes: > Another question now. I am unable to compile Postgresql 7.4 beta 3 under > cygwin (Windows 2K, using cgyipc 2). > I am getting the error: > " > creating information schema... ERROR: end-of-copy marker does not match > previous newline style > CONTEXT: