question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Query returns nulls in DBeaver and not other clients

See original GitHub issue

The following query returns nulls in DBeaver but not other clients

select
  t.*,
  CAST( CAST(t.date_key AS CHAR(8)) AS DATE FORMAT 'YYYYMMDD')
from schema.test_table as t

looking at the tooltip it looks like dbeaver is confused on the type of the result given that its showing the datetime icon but hovering says integer?

image

CREATE MULTISET TABLE schema.test_table ,NO FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      date_key INTEGER NOT NULL
     )
no primary index;
insert into schema.test_table values (20100101);
insert into schema.test_table values (20100102);
insert into schema.test_table values (20100103);
insert into schema.test_table values (20100104);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
serge-ridercommented, Aug 25, 2016

This is what causes problem with date values:

Unrecognized type 'java.sql.Date' - can't convert to numeric

DBeaver thinks that this column has numeric data type. This is because you second column has the same alias as the real table column (date_key). DBeaver tries to discover real attribute data type from database metadata whenever it is possible. Smarty pants.

Workaround - set some alias for your expression. And I’ll think how to handle this problem better…

0reactions
r-richmondcommented, Aug 25, 2016

makes sense… given that here is code that reproduces the issue in oracle

create table schema.test_table as select 20100101 as date_key from dual;

select
  t.*,
  to_date(cast(t.date_key as varchar(8)),'YYYYMMDD') as date_key
from schema.TEST_TABLE t;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Null pointer exception with BIGQUERY (some SQL formatting)
Hi, I am connecting to bigquery using community edition of dbeaver. I am getting Null pointer exception when I try to execute the...
Read more >
DBeaver throws SQL error when query contains empty lines
Re: DBeaver throws SQL error when query contains empty lines ... Actually it is not a bug. DBeaver has two modes of SQL...
Read more >
Connect DBeaver to BigQuery through ODBC - Google Cloud
Connect and access BigQuery data. After the DSN is configured, run DBeaver Community. Create a new database connection. Click New Database ...
Read more >
Connect to BigQuery Data in DBeaver - CData Software
Use the CData ODBC Driver to connect to BigQuery data in DBeaver. The CData ODBC Driver for BigQuery enables access to live data...
Read more >
Connecting to Google BigQuery with DBeaver with JDBC ...
Note there are 4 different ways to connect to BigQuery using the JDBC driver. This tutorial illustrates connecting using the service account ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found