-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
sql: lib/pq confused by unicode characters in text[], while psql is OK with them #31872
Comments
Thanks Anton for your problem report. If you use the
Note also that we are aware of numerous problems with |
@knz, thanks for reply! I have the same issue with psql. Probably it is a store processing problem. Reproduce Create table with data root@81142ab6c98d:/cockroach# ./cockroach sql --insecure
# Welcome to the cockroach SQL interface.
# All statements must be terminated by a semicolon.
# To exit: CTRL + D.
#
# Server version: CockroachDB CCL v2.0.6 (x86_64-unknown-linux-gnu, built 2018/10/01 13:59:40, go1.10) (same version as client)
# Cluster ID: b60deba7-37ed-43f6-986f-b3e20e62ef54
#
# Enter \? for a brief introduction.
#
warning: no current database set. Use SET database = <dbname> to change, CREATE DATABASE to make a new database.
root@:26257/> create database test;
CREATE DATABASE
Time: 10.19165ms
root@:26257/> set database = test;
SET
Time: 295.408µs
root@:26257/test> create table test (test text[] NOT NULL);
CREATE TABLE
Time: 13.422543ms
root@:26257/test> insert into test values ('Т');
pq: value type string doesn't match type ARRAY of column "test"
root@:26257/test> insert into test values (ARRAY ['Т']);
INSERT 1
Time: 2.62925ms
root@:26257/test> select * from test;
+------------+
| test |
+------------+
| {"\u0422"} |
+------------+
(1 row)
Time: 3.549855ms Select data using psql root@81142ab6c98d:/cockroach# psql -h 127.0.0.1 -d test -p 26257
psql (9.4.19, server 9.5.0)
WARNING: psql major version 9.4, server major version 9.5.
Some psql features might not work.
Type "help" for help.
test=> select * from test;
test
------------
{"\u0422"}
(1 row) Also I have the same issue with |
Nevertheless, you can verify that the issue is only in the client/server protocol and not in the CockroachDB store:
|
Yes root@:26257/test> select length(test[1]) from test;
+--------+
| length |
+--------+
| 1 |
+--------+
(1 row)
Time: 1.664317ms |
Since CockroachDB version: 2.1.0 it's ok with |
Thank you for confirming. @mjibson btw this is an example of what we were discussing last week, encoding behavior is different but is valid. |
russian character \u0422 'Т' (capital te) not saved well if it's inside of a string array.
To Reproduce
Environment:
cockroach sql
,golang: pq
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: