Switch JDBC metadata to indicate all columns nullable (elastic/x-pack-elasticsearch#2835)

We were returning "nullability unknown" but in Elasticsearch all columns
are nullable.

Original commit: elastic/x-pack-elasticsearch@6ceae418ea
This commit is contained in:
Nik Everett 2017-11-04 23:28:49 +00:00 committed by GitHub
parent 00d30285e1
commit a211077554
2 changed files with 25 additions and 25 deletions

View File

@ -25,19 +25,19 @@ CREATE TABLE mock (
) AS ) AS
SELECT '', 'test1', 'name', 12, 'VARCHAR', 2147483647, null, null, SELECT '', 'test1', 'name', 12, 'VARCHAR', 2147483647, null, null,
10, -- NOCOMMIT 10 seem wrong to hard code for stuff like strings 10, -- NOCOMMIT 10 seem wrong to hard code for stuff like strings
2, -- columnNullableUnknown NOCOMMIT I think it'd be more correct to return columnNullable 1, -- columnNullable
null, null, null, null, null, 1, '', null, null, null, null, '', '' null, null, null, null, null, 1, 'YES', null, null, null, null, '', ''
FROM DUAL FROM DUAL
UNION ALL UNION ALL
SELECT '', 'test2', 'date', 93, 'TIMESTAMP', 19, null, null, SELECT '', 'test2', 'date', 93, 'TIMESTAMP', 19, null, null,
10, 10,
2, -- columnNullableUnknown NOCOMMIT I think it'd be more correct to return columnNullable 1, -- columnNullable
null, null, null, null, null, 1, '', null, null, null, null, '', '' null, null, null, null, null, 1, 'YES', null, null, null, null, '', ''
FROM DUAL FROM DUAL
UNION ALL UNION ALL
SELECT '', 'test2', 'number', -5, 'BIGINT', 19, null, null, SELECT '', 'test2', 'number', -5, 'BIGINT', 19, null, null,
10, 10,
2, -- columnNullableUnknown NOCOMMIT I think it'd be more correct to return columnNullable 1, -- columnNullable
null, null, null, null, null, 2, '', null, null, null, null, '', '' null, null, null, null, null, 2, 'YES', null, null, null, null, '', ''
FROM DUAL FROM DUAL
; ;

View File

@ -823,14 +823,14 @@ class JdbcDatabaseMetaData implements DatabaseMetaData, JdbcWrapper {
row[ 7] = null; row[ 7] = null;
row[ 8] = null; row[ 8] = null;
row[ 9] = 10; row[ 9] = 10;
row[10] = columnNullableUnknown; row[10] = columnNullable;
row[11] = null; row[11] = null;
row[12] = null; row[12] = null;
row[13] = null; row[13] = null;
row[14] = null; row[14] = null;
row[15] = null; row[15] = null;
row[16] = col.position; row[16] = col.position;
row[17] = ""; row[17] = "YES";
row[18] = null; row[18] = null;
row[19] = null; row[19] = null;
row[20] = null; row[20] = null;