-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Cannot find JDBC type '2003' in PostgreSQL column type #6408
Comments
@1ssqq1lxr Change sql to "SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid", is it ok? |
PG DB returned normally
…------------------ 原始邮件 ------------------
发件人: "JingShang Lu"<[email protected]>;
发送时间: 2020年7月23日(星期四) 中午11:30
收件人: "apache/shardingsphere"<[email protected]>;
抄送: "目光所及只有你"<[email protected]>; "Mention"<[email protected]>;
主题: Re: [apache/shardingsphere] SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid ::: DataSources: initds_master [ERROR] 02:51:14.421 [pool-4-thread-1] o.a.s.s.f.c.CommandExecutorTask - Exception occur: java.lang.IllegalArgumentException: Cannot find JDBC type '2003' in PostgreSQL column type (#6408)
@1ssqq1lxr Change sql to "SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid", is it ok?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@1ssqq1lxr Ok, could the origin sql directly run on pg server? |
the origin sql directly run on pg server is ok ,The result set can be returned correctly
…------------------ 原始邮件 ------------------
发件人: "JingShang Lu"<[email protected]>;
发送时间: 2020年7月23日(星期四) 中午12:01
收件人: "apache/shardingsphere"<[email protected]>;
抄送: "目光所及只有你"<[email protected]>; "Mention"<[email protected]>;
主题: Re: [apache/shardingsphere] SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid ::: DataSources: initds_master [ERROR] 02:51:14.421 [pool-4-thread-1] o.a.s.s.f.c.CommandExecutorTask - Exception occur: java.lang.IllegalArgumentException: Cannot find JDBC type '2003' in PostgreSQL column type (#6408)
@1ssqq1lxr Ok, could the origin sql directly run on pg server?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@1ssqq1lxr Maybe it is the parser problem. I'll check it. |
@1ssqq1lxr What's the meaning of "::: DataSources: initds_master", I didn't find the ':::' operator in PG. |
Complete SQL: SELECT d.oid, d.datname AS databasename, d.datacl, d.datistemplate, d.datallowconn, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid Do you mean there is something wrong with my data source configuration? I have switched multiple PostgreSQL versions and still have this problem。 masterSlaveRule: server.yaml: |
@1ssqq1lxr Origin sql is "SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid ::: DataSources: initds_master" , right? |
origin sql is "SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid" "::: DataSources: initds_master" getdatasouce log ? |
@1ssqq1lxr Ok, it is not parser problem and is the same to #3954 |
And so it's a critical bug for PG users, we should raise priority 0 for this issue now. |
Thank you. Can you solve it quickly |
it will be fixed in 5.0.0 |
Hi, I'd like try to solve it |
I've prepared a demo and reproduced the error result. After reading some code and debuging, java.sql.Types.ARRAY=2003, many types could be used as array and they have their own unique type oid, e.g. INT4_ARRAY=1007, INT8_ARRAY=1016, so jdbc array columnType(2003) is not enough to get exact array oid. There are 2 possible solutions for now: 1, Get resultSetMetaData from queryResponse.queryResults, use PostgreSQL's implementation PgResultSetMetaData, get field of column index via java reflection, then get type oid. The disadvantage is: a) direct dependency of postgresql jdbc driver, b) once the internal implementation of PostgreSQL jdbc driver changed, then it doesn't work. 2, Get resultSetMetaData from queryResponse.queryResults, use getColumnTypeName(column) method to get database specific type name (e.g. integer array is _int4), then translate it to type oid (e.g. 1007), PostgreSQL has the mapping definition. I prefer solution 2, though it need more code. |
seems meet this problem again on shardingsphere proxy:5.4.1 |
SELECT d.oid, d.datname AS databasename, d.datacl, pg_get_userbyid(d.datdba) AS databaseowner, d.datcollate, d.datctype, shobj_description(d.oid, 'pg_database') AS description, d.datconnlimit, t.spcname, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace = t.oid ::: DataSources: initds_master
[ERROR] 02:51:14.421 [pool-4-thread-1] o.a.s.s.f.c.CommandExecutorTask - Exception occur:
java.lang.IllegalArgumentException: Cannot find JDBC type '2003' in PostgreSQL column type
The text was updated successfully, but these errors were encountered: