Re: [GENERAL] Postgres 7.3b1 + JDBC3 (2002-09-05) truncates SQL

Oliver Jowett <oliver@opencloud.com>

From: Oliver Jowett <oliver@opencloud.com>
To: Barry Lind <barry@xythos.com>
Cc: "H. Meyer" <nospaming@gmx.net>, pgsql-jdbc@postgresql.org
Date: 2002-09-18T22:22:54Z
Lists: pgsql-general
I've seen something like this -- it was due to an embedded null (\0) in a
string value being inserted (presumably at the end of 'SCRAPBOOK', here)
which the JDBC driver doesn't escape and the backend appears to treat as
"end of query string". Took me a while to find as printing Strings doesn't
show nulls!

I experimented with escaping it in the driver, but it looks like the backend
doesn't support embedded nulls in TEXT either? (the stored value is silently
truncated at the null).

-O

On Wed, Sep 18, 2002 at 10:08:14AM -0700, Barry Lind wrote:
> I can't reproduce this problem.  Can you submit a simple test case that 
> reproduces the problem?
> 
> thanks,
> --Barry
> 
> 
> 
> H. Meyer wrote:
> >hi
> >
> >i have a very wired problem.
> >when i try to execute the following SQL command:
> >
> >INSERT INTO SERIES 
> >(seriesDateTime,modality,seriesnumber,seriesinstanceuid,seriesdescr,bodypartexamined,slicethickness,sequencename,viewdirection,studytype,fieldofview,contrastAgent,numberseriesrelatedimages,manufacturermodel,stuParent,insertTimestamp) 
> >VALUES ('2002-05-07 14:34:12.0', 'MR', '2', 
> >'1.2.804.114118.1.20020507.143415.2812940098.1.1', 'SCRAPBOOK', '', 
> >'006.000000E+00', 'b0_1000', 'HEAD', 'MEA', '261*261', '', 0, 'MAGNETOM 
> >Harmony', '1.3.12.2.1107.5.2.5.10288.20020426150938000', '2002-09-17 
> >11:07:30.293');
> >
> >via the JDBC3 beta driver for postgres 7.3b1 i get the following error.
> >
> >2002-09-17 11:07:30 [24588]  LOG:  query: INSERT INTO SERIES 
> >(seriesDateTime,modality,seriesnumber,seriesinstanceuid,seriesdescr,bodypartexamined,slicethickness,sequencename,viewdirection,studytype,fieldofview,contrastAgent,numberseriesrelatedimages,manufacturermodel,stuParent,insertTimestamp) 
> >VALUES ('2002-05-07 14:34:12.0', 'MR', '2', 
> >'1.2.804.114118.1.20020507.143415.2812940098.1.1', 'SCRAPBOOK
> >2002-09-17 11:07:30 [24588]  ERROR:  parser: unterminated quoted string 
> >at or near "'SCRAPBOOK" at character 349
> >2002-09-17 11:07:30 [24588]  LOG:  statement: INSERT INTO SERIES 
> >(seriesDateTime,modality,seriesnumber,seriesinstanceuid,seriesdescr,bodypartexamined,slicethickness,sequencename,viewdirection,studytype,fieldofview,contrastAgent,numberseriesrelatedimages,manufacturermodel,stuParent,insertTimestamp) 
> >VALUES ('2002-05-07 14:34:12.0', 'MR', '2', 
> >'1.2.804.114118.1.20020507.143415.2812940098.1.1', 'SCRAPBOOK

[...]