Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage return and form feed in TEXT fields are returned as 'r' and 'f' in jdbcclient and ResultSets #6350

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working Client interfaces normal

Comments

@monetdb-team
Copy link

Date: 2017-07-11 16:45:10 +0200
From: Leon Helwerda <<l.s.helwerda>>
To: Martin van Dinther <<martin.van.dinther>>
Version: 11.25.15 (Dec2016-SP3)
CC: martin.van.dinther

Last updated: 2017-10-26 14:01:29 +0200

Comment 25451

Date: 2017-07-11 16:45:10 +0200
From: Leon Helwerda <<l.s.helwerda>>

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0
Build Identifier:

Certain control characters, such as the carriage return ('\r') and form feed ('\f') are returned as the character that they are represented as, but even without the backslash ('r' and 'f', respectively) rather than as an actual control character. This makes such special characters indistinguishable from unrelated normal characters. Other characters like '\n' do work as expected.

Reproducible: Always

Steps to Reproduce:

$ java -jar ~/Downloads/jdbcclient.jar -d db
password:
Welcome to the MonetDB interactive JDBC terminal!
Database Server: MonetDB v11.25.15
JDBC Driver: MonetDB Native Driver v2.24 (Liberica 20161215 based on MCL v1.14)
Current Schema: sys
Type \q to quit, \h for a list of available commands
auto commit mode: on
sql> CREATE TABLE test (message TEXT);
Operation successful. Elapsed Time: 39 ms
sql> INSERT INTO test VALUES ('hello\r\nworld');
1 affected row. Elapsed Time: 26 ms
sql> INSERT INTO test VALUES ('hello\fworld');
1 affected row. Elapsed Time: 23 ms

Actual Results:

$ java -jar ~/Downloads/jdbcclient.jar
sql> SELECT * FROM test;
+--------------+
| message |
+==============+
| hellor
world |
| hellofworld |
+--------------+
2 rows
Elapsed Time: 24 ms

The 'r' and 'f' in these results are normal characters also visible in ResultSets, while the newline is (correctly) presented in the result.

Expected Results:

The result from mclient on the same table as create above (regardless of whether the rows were created with jdbcclient or mclient) shows a more expected result:

$ mclient -d db
password:
Welcome to mclient, the MonetDB/SQL interactive terminal (Dec2016-SP4)
Database: MonetDB v11.25.15 (Dec2016-SP3), 'mapi:monetdb://localhost:50000/db'
Type \q to quit, ? for a list of available commands
auto commit mode: on
sql>SELECT * FROM test;
+--------------+
| message |
+==============+
| hello |
: world :
| hello
world |
+--------------+

Obviously, in Java applications, the strings are supposed contain the appropriate control characters instead of the fancy output as shown here.

Comment 25673

Date: 2017-09-28 15:05:32 +0200
From: MonetDB Mercurial Repository <>

Changeset e5c67a23d7d6, made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the monetdb-java repo, refers to this bug.

For complete details, see https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=e5c67a23d7d6

Changeset description:

Fix for bug #6350

Comment 25674

Date: 2017-09-28 16:56:26 +0200
From: Martin van Dinther <<martin.van.dinther>>

Fix will be included in the next release of jdbcclient.jar and JDBC driver (v2.27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client interfaces normal
Projects
None yet
Development

No branches or pull requests

2 participants