Обсуждение: Unterminated quoted string error.
Hi all, I'm currently chasing down a bug. Wonder if anyone can throw some light on it. I get the following exception. An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer Stack Trace: java.io.IOException: Connection reset by peer at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java:83) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) at org.postgresql.PG_Stream.flush(PG_Stream.java:414) at org.postgresql.Connection.ExecSQL(Connection.java:479) at org.postgresql.jdbc2.Statement.execute(Statement.java:294) at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) And in the postgresql.log file I get... ERROR: Unterminated quoted string FATAL 1: Socket command type unknown But I'm pretty sure that my strings are quoted properly. That is to say that there are about 90 escaped single quotes in a string I'm inserting also though. Anyone seen this before? I'm currently using a version of the driver that I compiled from cvs on the 18th of Jun. Was anything patched since that might effect this? Anyway, I've been digging around for quite a while now so I thought I'd shoot the list a mail before going to bed. Tom. -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs
I had a similar problem and fixed it by using a preparedStatement and setting the parameter of my string data using myPreparedStatement.setString(myString) t.r. missner level(3) communications -----Original Message----- From: Thomas O'Dowd [mailto:tom@nooper.com] Sent: Tuesday, August 28, 2001 9:23 AM To: pgsql-jdbc@postgresql.org Subject: [JDBC] Unterminated quoted string error. Hi all, I'm currently chasing down a bug. Wonder if anyone can throw some light on it. I get the following exception. An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer Stack Trace: java.io.IOException: Connection reset by peer at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java:83) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) at org.postgresql.PG_Stream.flush(PG_Stream.java:414) at org.postgresql.Connection.ExecSQL(Connection.java:479) at org.postgresql.jdbc2.Statement.execute(Statement.java:294) at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java: 122) And in the postgresql.log file I get... ERROR: Unterminated quoted string FATAL 1: Socket command type unknown But I'm pretty sure that my strings are quoted properly. That is to say that there are about 90 escaped single quotes in a string I'm inserting also though. Anyone seen this before? I'm currently using a version of the driver that I compiled from cvs on the 18th of Jun. Was anything patched since that might effect this? Anyway, I've been digging around for quite a while now so I thought I'd shoot the list a mail before going to bed. Tom. -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Thomas, If you turn on debug messages on the server to print out the SQL statements it receives you should be able to get the exact string that the server is receiving from the client and failing on. That might help you find the problem. thanks, --Barry Thomas O'Dowd wrote: > Hi all, > > I'm currently chasing down a bug. Wonder if anyone can throw some light > on it. I get the following exception. > > An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > Stack Trace: > > java.io.IOException: Connection reset by peer > at java.net.SocketOutputStream.socketWrite(Native Method) > at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > at org.postgresql.Connection.ExecSQL(Connection.java:479) > at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > > > And in the postgresql.log file I get... > > ERROR: Unterminated quoted string > FATAL 1: Socket command type > unknown > > But I'm pretty sure that my strings are quoted properly. That is to say that > there are about 90 escaped single quotes in a string I'm inserting also though. > > Anyone seen this before? I'm currently using a version of the driver > that I compiled from cvs on the 18th of Jun. Was anything patched since > that might effect this? > > Anyway, I've been digging around for quite a while now so I thought I'd > shoot the list a mail before going to bed. > > Tom. >
Thats exactly what I'm doing :) My preparedStatement is like. You'll notice its a PreparedStatement if you look at the stack trace below. con.prepareStatement("INSERT INTO A VALUES(?)"); ps.setString(1, stringdata); ps.executeUpdate(); I'm wondering is it a length problem since the field is type text and the string is length 42,460. Any ideas? Tom. On Tue, Aug 28, 2001 at 11:18:25AM -0600, T.R.Missner@level3.com wrote: > I had a similar problem and fixed it by using a preparedStatement and > setting the parameter of my string data using > myPreparedStatement.setString(myString) > > > t.r. missner > level(3) communications > > -----Original Message----- > From: Thomas O'Dowd [mailto:tom@nooper.com] > Sent: Tuesday, August 28, 2001 9:23 AM > To: pgsql-jdbc@postgresql.org > Subject: [JDBC] Unterminated quoted string error. > > > Hi all, > > I'm currently chasing down a bug. Wonder if anyone can throw some light > on it. I get the following exception. > > An I/O error has occured while flushing the output - Exception: > java.io.IOException: Connection reset by peer > Stack Trace: > > java.io.IOException: Connection reset by peer > at java.net.SocketOutputStream.socketWrite(Native Method) > at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > at > java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > at org.postgresql.Connection.ExecSQL(Connection.java:479) > at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > at > org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java: > 122) > > > And in the postgresql.log file I get... > > ERROR: Unterminated quoted string > FATAL 1: Socket command type > unknown > > But I'm pretty sure that my strings are quoted properly. That is to say that > there are about 90 escaped single quotes in a string I'm inserting also > though. > > Anyone seen this before? I'm currently using a version of the driver > that I compiled from cvs on the 18th of Jun. Was anything patched since > that might effect this? > > Anyway, I've been digging around for quite a while now so I thought I'd > shoot the list a mail before going to bed. > > Tom. > -- > Thomas O'Dowd. - Nooping - http://nooper.com > tom@nooper.com - Testing - http://nooper.co.jp/labs > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs
Thanks Barry, I turned on debugging in postgresql. I found that the query is being truncated and is not fully making it to the backend, therefore I'm getting the Unterminated string error. I'll have a look into why and report back if I find anything. Cheers, Tom. On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: > Thomas, > > If you turn on debug messages on the server to print out the SQL > statements it receives you should be able to get the exact string that > the server is receiving from the client and failing on. That might help > you find the problem. > > thanks, > --Barry > > Thomas O'Dowd wrote: > > Hi all, > > > > I'm currently chasing down a bug. Wonder if anyone can throw some light > > on it. I get the following exception. > > > > An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > > Stack Trace: > > > > java.io.IOException: Connection reset by peer > > at java.net.SocketOutputStream.socketWrite(Native Method) > > at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > > at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > > at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > > at org.postgresql.Connection.ExecSQL(Connection.java:479) > > at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > > at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > > at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > > > > > > And in the postgresql.log file I get... > > > > ERROR: Unterminated quoted string > > FATAL 1: Socket command type > > unknown > > > > But I'm pretty sure that my strings are quoted properly. That is to say that > > there are about 90 escaped single quotes in a string I'm inserting also though. > > > > Anyone seen this before? I'm currently using a version of the driver > > that I compiled from cvs on the 18th of Jun. Was anything patched since > > that might effect this? > > > > Anyway, I've been digging around for quite a while now so I thought I'd > > shoot the list a mail before going to bed. > > > > Tom. > > > > -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs
I found problem. My string has a null character in the middle of it. I noticed from the Connection.java code that the null character idicates end of query so I guess that is what is happening. I'll strip out my null strings in the mean time as they are not needed before sending them to the driver but I'm wondering if the preparedStatement.setString() shouldn't escape nulls or something. It already escapes single quotes and backslashes. What do people think? Cheers, Tom. On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: > Thanks Barry, > > I turned on debugging in postgresql. I found that the query is being truncated > and is not fully making it to the backend, therefore I'm getting the > Unterminated string error. I'll have a look into why and report back if > I find anything. > > Cheers, > > Tom. > > On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: > > Thomas, > > > > If you turn on debug messages on the server to print out the SQL > > statements it receives you should be able to get the exact string that > > the server is receiving from the client and failing on. That might help > > you find the problem. > > > > thanks, > > --Barry > > > > Thomas O'Dowd wrote: > > > Hi all, > > > > > > I'm currently chasing down a bug. Wonder if anyone can throw some light > > > on it. I get the following exception. > > > > > > An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > > > Stack Trace: > > > > > > java.io.IOException: Connection reset by peer > > > at java.net.SocketOutputStream.socketWrite(Native Method) > > > at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > > > at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > > > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > > > at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > > > at org.postgresql.Connection.ExecSQL(Connection.java:479) > > > at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > > > at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > > > at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > > > > > > > > > And in the postgresql.log file I get... > > > > > > ERROR: Unterminated quoted string > > > FATAL 1: Socket command type > > > unknown > > > > > > But I'm pretty sure that my strings are quoted properly. That is to say that > > > there are about 90 escaped single quotes in a string I'm inserting also though. > > > > > > Anyone seen this before? I'm currently using a version of the driver > > > that I compiled from cvs on the 18th of Jun. Was anything patched since > > > that might effect this? > > > > > > Anyway, I've been digging around for quite a while now so I thought I'd > > > shoot the list a mail before going to bed. > > > > > > Tom. > > > > > > > > > -- > Thomas O'Dowd. - Nooping - http://nooper.com > tom@nooper.com - Testing - http://nooper.co.jp/labs > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs
Thomas, The text datatypes in postgres (i.e. char, varchar, text) do not support storing null characters. If your data contains nulls then you need to use the binary datatype bytea. Unfortunately the JDBC drivers do not currently support the bytea datatype. thanks, --Barry Thomas O'Dowd wrote: > I found problem. My string has a null character in the middle of it. I > noticed from the Connection.java code that the null character idicates > end of query so I guess that is what is happening. I'll strip out my > null strings in the mean time as they are not needed before sending them > to the driver but I'm wondering if the preparedStatement.setString() > shouldn't escape nulls or something. It already escapes single quotes and > backslashes. What do people think? > > Cheers, > > Tom. > > On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: > >>Thanks Barry, >> >>I turned on debugging in postgresql. I found that the query is being truncated >>and is not fully making it to the backend, therefore I'm getting the >>Unterminated string error. I'll have a look into why and report back if >>I find anything. >> >>Cheers, >> >>Tom. >> >>On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: >> >>>Thomas, >>> >>>If you turn on debug messages on the server to print out the SQL >>>statements it receives you should be able to get the exact string that >>>the server is receiving from the client and failing on. That might help >>>you find the problem. >>> >>>thanks, >>>--Barry >>> >>>Thomas O'Dowd wrote: >>> >>>>Hi all, >>>> >>>>I'm currently chasing down a bug. Wonder if anyone can throw some light >>>>on it. I get the following exception. >>>> >>>>An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer >>>>Stack Trace: >>>> >>>>java.io.IOException: Connection reset by peer >>>> at java.net.SocketOutputStream.socketWrite(Native Method) >>>> at java.net.SocketOutputStream.write(SocketOutputStream.java:83) >>>> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) >>>> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) >>>> at org.postgresql.PG_Stream.flush(PG_Stream.java:414) >>>> at org.postgresql.Connection.ExecSQL(Connection.java:479) >>>> at org.postgresql.jdbc2.Statement.execute(Statement.java:294) >>>> at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) >>>> at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) >>>> >>>> >>>>And in the postgresql.log file I get... >>>> >>>>ERROR: Unterminated quoted string >>>>FATAL 1: Socket command type >>>> unknown >>>> >>>>But I'm pretty sure that my strings are quoted properly. That is to say that >>>>there are about 90 escaped single quotes in a string I'm inserting also though. >>>> >>>>Anyone seen this before? I'm currently using a version of the driver >>>>that I compiled from cvs on the 18th of Jun. Was anything patched since >>>>that might effect this? >>>> >>>>Anyway, I've been digging around for quite a while now so I thought I'd >>>>shoot the list a mail before going to bed. >>>> >>>>Tom. >>>> >>>> >>> >>-- >>Thomas O'Dowd. - Nooping - http://nooper.com >>tom@nooper.com - Testing - http://nooper.co.jp/labs >> >>---------------------------(end of broadcast)--------------------------- >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >> >
Hi Barry, I looked in the postgresql documentation and couldn't find any mention of a "bytea" type. Well actually, I found .. $ grep -i bytea * bki-commands.html:>bytea</TT catalog-pg-proc.html:>bytea</TT xfunc-c.html:>bytea</TD xfunc-c.html:>(bytea *)</TD but no real info on what it is, or no mention of it in the main types page. Anyway, I think I'm fine for now, stipping the null chars from my data. Tom. On Tue, Aug 28, 2001 at 09:17:19PM -0700, Barry Lind wrote: > Thomas, > > The text datatypes in postgres (i.e. char, varchar, text) do not support > storing null characters. If your data contains nulls then you need to > use the binary datatype bytea. Unfortunately the JDBC drivers do not > currently support the bytea datatype. > > thanks, > --Barry > > Thomas O'Dowd wrote: > > I found problem. My string has a null character in the middle of it. I > > noticed from the Connection.java code that the null character idicates > > end of query so I guess that is what is happening. I'll strip out my > > null strings in the mean time as they are not needed before sending them > > to the driver but I'm wondering if the preparedStatement.setString() > > shouldn't escape nulls or something. It already escapes single quotes and > > backslashes. What do people think? > > > > Cheers, > > > > Tom. > > > > On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: > > > >>Thanks Barry, > >> > >>I turned on debugging in postgresql. I found that the query is being truncated > >>and is not fully making it to the backend, therefore I'm getting the > >>Unterminated string error. I'll have a look into why and report back if > >>I find anything. > >> > >>Cheers, > >> > >>Tom. > >> > >>On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: > >> > >>>Thomas, > >>> > >>>If you turn on debug messages on the server to print out the SQL > >>>statements it receives you should be able to get the exact string that > >>>the server is receiving from the client and failing on. That might help > >>>you find the problem. > >>> > >>>thanks, > >>>--Barry > >>> > >>>Thomas O'Dowd wrote: > >>> > >>>>Hi all, > >>>> > >>>>I'm currently chasing down a bug. Wonder if anyone can throw some light > >>>>on it. I get the following exception. > >>>> > >>>>An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > >>>>Stack Trace: > >>>> > >>>>java.io.IOException: Connection reset by peer > >>>> at java.net.SocketOutputStream.socketWrite(Native Method) > >>>> at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > >>>> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > >>>> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > >>>> at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > >>>> at org.postgresql.Connection.ExecSQL(Connection.java:479) > >>>> at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > >>>> at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > >>>> at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > >>>> > >>>> > >>>>And in the postgresql.log file I get... > >>>> > >>>>ERROR: Unterminated quoted string > >>>>FATAL 1: Socket command type > >>>> unknown > >>>> > >>>>But I'm pretty sure that my strings are quoted properly. That is to say that > >>>>there are about 90 escaped single quotes in a string I'm inserting also though. > >>>> > >>>>Anyone seen this before? I'm currently using a version of the driver > >>>>that I compiled from cvs on the 18th of Jun. Was anything patched since > >>>>that might effect this? > >>>> > >>>>Anyway, I've been digging around for quite a while now so I thought I'd > >>>>shoot the list a mail before going to bed. > >>>> > >>>>Tom. > >>>> > >>>> > >>> > >>-- > >>Thomas O'Dowd. - Nooping - http://nooper.com > >>tom@nooper.com - Testing - http://nooper.co.jp/labs > >> > >>---------------------------(end of broadcast)--------------------------- > >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >> > > > > -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs
Thomas, You are correct about the poor documentation for bytea. I hear this is fixed in 7.2 docs, but haven't verified. I learned about it myself by looking at the internal pg_* tables and seeing how they used it. I'm glad to hear that you have a workaround for your original issue. thanks, --Barry Thomas O'Dowd wrote: > Hi Barry, > > I looked in the postgresql documentation and couldn't find any mention > of a "bytea" type. Well actually, I found .. > > $ grep -i bytea * > bki-commands.html:>bytea</TT > catalog-pg-proc.html:>bytea</TT > xfunc-c.html:>bytea</TD > xfunc-c.html:>(bytea *)</TD > > but no real info on what it is, or no mention of it in the main types page. > Anyway, I think I'm fine for now, stipping the null chars from my data. > > Tom. > > On Tue, Aug 28, 2001 at 09:17:19PM -0700, Barry Lind wrote: > >>Thomas, >> >>The text datatypes in postgres (i.e. char, varchar, text) do not support >>storing null characters. If your data contains nulls then you need to >>use the binary datatype bytea. Unfortunately the JDBC drivers do not >>currently support the bytea datatype. >> >>thanks, >>--Barry >> >>Thomas O'Dowd wrote: >> >>>I found problem. My string has a null character in the middle of it. I >>>noticed from the Connection.java code that the null character idicates >>>end of query so I guess that is what is happening. I'll strip out my >>>null strings in the mean time as they are not needed before sending them >>>to the driver but I'm wondering if the preparedStatement.setString() >>>shouldn't escape nulls or something. It already escapes single quotes and >>>backslashes. What do people think? >>> >>>Cheers, >>> >>>Tom. >>> >>>On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: >>> >>> >>>>Thanks Barry, >>>> >>>>I turned on debugging in postgresql. I found that the query is being truncated >>>>and is not fully making it to the backend, therefore I'm getting the >>>>Unterminated string error. I'll have a look into why and report back if >>>>I find anything. >>>> >>>>Cheers, >>>> >>>>Tom. >>>> >>>>On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: >>>> >>>> >>>>>Thomas, >>>>> >>>>>If you turn on debug messages on the server to print out the SQL >>>>>statements it receives you should be able to get the exact string that >>>>>the server is receiving from the client and failing on. That might help >>>>>you find the problem. >>>>> >>>>>thanks, >>>>>--Barry >>>>> >>>>>Thomas O'Dowd wrote: >>>>> >>>>> >>>>>>Hi all, >>>>>> >>>>>>I'm currently chasing down a bug. Wonder if anyone can throw some light >>>>>>on it. I get the following exception. >>>>>> >>>>>>An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer >>>>>>Stack Trace: >>>>>> >>>>>>java.io.IOException: Connection reset by peer >>>>>> at java.net.SocketOutputStream.socketWrite(Native Method) >>>>>> at java.net.SocketOutputStream.write(SocketOutputStream.java:83) >>>>>> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) >>>>>> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) >>>>>> at org.postgresql.PG_Stream.flush(PG_Stream.java:414) >>>>>> at org.postgresql.Connection.ExecSQL(Connection.java:479) >>>>>> at org.postgresql.jdbc2.Statement.execute(Statement.java:294) >>>>>> at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) >>>>>> at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) >>>>>> >>>>>> >>>>>>And in the postgresql.log file I get... >>>>>> >>>>>>ERROR: Unterminated quoted string >>>>>>FATAL 1: Socket command type >>>>>>unknown >>>>>> >>>>>>But I'm pretty sure that my strings are quoted properly. That is to say that >>>>>>there are about 90 escaped single quotes in a string I'm inserting also though. >>>>>> >>>>>>Anyone seen this before? I'm currently using a version of the driver >>>>>>that I compiled from cvs on the 18th of Jun. Was anything patched since >>>>>>that might effect this? >>>>>> >>>>>>Anyway, I've been digging around for quite a while now so I thought I'd >>>>>>shoot the list a mail before going to bed. >>>>>> >>>>>>Tom. >>>>>> >>>>>> >>>>>> >>>>-- >>>>Thomas O'Dowd. - Nooping - http://nooper.com >>>>tom@nooper.com - Testing - http://nooper.co.jp/labs >>>> >>>>---------------------------(end of broadcast)--------------------------- >>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >>>> >>>> >> >
I have added a description to the CVS and it will appear in 7.2. It is in the development docs now. > Hi Barry, > > I looked in the postgresql documentation and couldn't find any mention > of a "bytea" type. Well actually, I found .. > > $ grep -i bytea * > bki-commands.html:>bytea</TT > catalog-pg-proc.html:>bytea</TT > xfunc-c.html:>bytea</TD > xfunc-c.html:>(bytea *)</TD > > but no real info on what it is, or no mention of it in the main types page. > Anyway, I think I'm fine for now, stipping the null chars from my data. > > Tom. > > On Tue, Aug 28, 2001 at 09:17:19PM -0700, Barry Lind wrote: > > Thomas, > > > > The text datatypes in postgres (i.e. char, varchar, text) do not support > > storing null characters. If your data contains nulls then you need to > > use the binary datatype bytea. Unfortunately the JDBC drivers do not > > currently support the bytea datatype. > > > > thanks, > > --Barry > > > > Thomas O'Dowd wrote: > > > I found problem. My string has a null character in the middle of it. I > > > noticed from the Connection.java code that the null character idicates > > > end of query so I guess that is what is happening. I'll strip out my > > > null strings in the mean time as they are not needed before sending them > > > to the driver but I'm wondering if the preparedStatement.setString() > > > shouldn't escape nulls or something. It already escapes single quotes and > > > backslashes. What do people think? > > > > > > Cheers, > > > > > > Tom. > > > > > > On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: > > > > > >>Thanks Barry, > > >> > > >>I turned on debugging in postgresql. I found that the query is being truncated > > >>and is not fully making it to the backend, therefore I'm getting the > > >>Unterminated string error. I'll have a look into why and report back if > > >>I find anything. > > >> > > >>Cheers, > > >> > > >>Tom. > > >> > > >>On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: > > >> > > >>>Thomas, > > >>> > > >>>If you turn on debug messages on the server to print out the SQL > > >>>statements it receives you should be able to get the exact string that > > >>>the server is receiving from the client and failing on. That might help > > >>>you find the problem. > > >>> > > >>>thanks, > > >>>--Barry > > >>> > > >>>Thomas O'Dowd wrote: > > >>> > > >>>>Hi all, > > >>>> > > >>>>I'm currently chasing down a bug. Wonder if anyone can throw some light > > >>>>on it. I get the following exception. > > >>>> > > >>>>An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > > >>>>Stack Trace: > > >>>> > > >>>>java.io.IOException: Connection reset by peer > > >>>> at java.net.SocketOutputStream.socketWrite(Native Method) > > >>>> at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > > >>>> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > > >>>> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > > >>>> at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > > >>>> at org.postgresql.Connection.ExecSQL(Connection.java:479) > > >>>> at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > > >>>> at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > > >>>> at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > > >>>> > > >>>> > > >>>>And in the postgresql.log file I get... > > >>>> > > >>>>ERROR: Unterminated quoted string > > >>>>FATAL 1: Socket command type > > >>>> unknown > > >>>> > > >>>>But I'm pretty sure that my strings are quoted properly. That is to say that > > >>>>there are about 90 escaped single quotes in a string I'm inserting also though. > > >>>> > > >>>>Anyone seen this before? I'm currently using a version of the driver > > >>>>that I compiled from cvs on the 18th of Jun. Was anything patched since > > >>>>that might effect this? > > >>>> > > >>>>Anyway, I've been digging around for quite a while now so I thought I'd > > >>>>shoot the list a mail before going to bed. > > >>>> > > >>>>Tom. > > >>>> > > >>>> > > >>> > > >>-- > > >>Thomas O'Dowd. - Nooping - http://nooper.com > > >>tom@nooper.com - Testing - http://nooper.co.jp/labs > > >> > > >>---------------------------(end of broadcast)--------------------------- > > >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > >> > > > > > > > > > -- > Thomas O'Dowd. - Nooping - http://nooper.com > tom@nooper.com - Testing - http://nooper.co.jp/labs > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
I heard it was fixed too but looking around, I found nothing. I added it tonight to the types section. > Thomas, > > You are correct about the poor documentation for bytea. I hear this is > fixed in 7.2 docs, but haven't verified. I learned about it myself by > looking at the internal pg_* tables and seeing how they used it. > > I'm glad to hear that you have a workaround for your original issue. > > thanks, > --Barry > > Thomas O'Dowd wrote: > > Hi Barry, > > > > I looked in the postgresql documentation and couldn't find any mention > > of a "bytea" type. Well actually, I found .. > > > > $ grep -i bytea * > > bki-commands.html:>bytea</TT > > catalog-pg-proc.html:>bytea</TT > > xfunc-c.html:>bytea</TD > > xfunc-c.html:>(bytea *)</TD > > > > but no real info on what it is, or no mention of it in the main types page. > > Anyway, I think I'm fine for now, stipping the null chars from my data. > > > > Tom. > > > > On Tue, Aug 28, 2001 at 09:17:19PM -0700, Barry Lind wrote: > > > >>Thomas, > >> > >>The text datatypes in postgres (i.e. char, varchar, text) do not support > >>storing null characters. If your data contains nulls then you need to > >>use the binary datatype bytea. Unfortunately the JDBC drivers do not > >>currently support the bytea datatype. > >> > >>thanks, > >>--Barry > >> > >>Thomas O'Dowd wrote: > >> > >>>I found problem. My string has a null character in the middle of it. I > >>>noticed from the Connection.java code that the null character idicates > >>>end of query so I guess that is what is happening. I'll strip out my > >>>null strings in the mean time as they are not needed before sending them > >>>to the driver but I'm wondering if the preparedStatement.setString() > >>>shouldn't escape nulls or something. It already escapes single quotes and > >>>backslashes. What do people think? > >>> > >>>Cheers, > >>> > >>>Tom. > >>> > >>>On Wed, Aug 29, 2001 at 08:53:31AM +0900, Thomas O'Dowd wrote: > >>> > >>> > >>>>Thanks Barry, > >>>> > >>>>I turned on debugging in postgresql. I found that the query is being truncated > >>>>and is not fully making it to the backend, therefore I'm getting the > >>>>Unterminated string error. I'll have a look into why and report back if > >>>>I find anything. > >>>> > >>>>Cheers, > >>>> > >>>>Tom. > >>>> > >>>>On Tue, Aug 28, 2001 at 12:56:50PM -0700, Barry Lind wrote: > >>>> > >>>> > >>>>>Thomas, > >>>>> > >>>>>If you turn on debug messages on the server to print out the SQL > >>>>>statements it receives you should be able to get the exact string that > >>>>>the server is receiving from the client and failing on. That might help > >>>>>you find the problem. > >>>>> > >>>>>thanks, > >>>>>--Barry > >>>>> > >>>>>Thomas O'Dowd wrote: > >>>>> > >>>>> > >>>>>>Hi all, > >>>>>> > >>>>>>I'm currently chasing down a bug. Wonder if anyone can throw some light > >>>>>>on it. I get the following exception. > >>>>>> > >>>>>>An I/O error has occured while flushing the output - Exception: java.io.IOException: Connection reset by peer > >>>>>>Stack Trace: > >>>>>> > >>>>>>java.io.IOException: Connection reset by peer > >>>>>> at java.net.SocketOutputStream.socketWrite(Native Method) > >>>>>> at java.net.SocketOutputStream.write(SocketOutputStream.java:83) > >>>>>> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72) > >>>>>> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130) > >>>>>> at org.postgresql.PG_Stream.flush(PG_Stream.java:414) > >>>>>> at org.postgresql.Connection.ExecSQL(Connection.java:479) > >>>>>> at org.postgresql.jdbc2.Statement.execute(Statement.java:294) > >>>>>> at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:78) > >>>>>> at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:122) > >>>>>> > >>>>>> > >>>>>>And in the postgresql.log file I get... > >>>>>> > >>>>>>ERROR: Unterminated quoted string > >>>>>>FATAL 1: Socket command type > >>>>>>unknown > >>>>>> > >>>>>>But I'm pretty sure that my strings are quoted properly. That is to say that > >>>>>>there are about 90 escaped single quotes in a string I'm inserting also though. > >>>>>> > >>>>>>Anyone seen this before? I'm currently using a version of the driver > >>>>>>that I compiled from cvs on the 18th of Jun. Was anything patched since > >>>>>>that might effect this? > >>>>>> > >>>>>>Anyway, I've been digging around for quite a while now so I thought I'd > >>>>>>shoot the list a mail before going to bed. > >>>>>> > >>>>>>Tom. > >>>>>> > >>>>>> > >>>>>> > >>>>-- > >>>>Thomas O'Dowd. - Nooping - http://nooper.com > >>>>tom@nooper.com - Testing - http://nooper.co.jp/labs > >>>> > >>>>---------------------------(end of broadcast)--------------------------- > >>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >>>> > >>>> > >> > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026