aws / aws/amazon-redshift-jdbc-driver

ERROR: bad lexical cast: source type value could not be interpreted as target

Open
#138 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
71
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Hi, we're from Metabase and a customer of us is getting:
```
Error executing query: ERROR: bad lexical cast: source type value could not be interpreted as target"
```
when running the following query

```
SELECT
c.column_name AS name,
c.data_type AS "database-type",
c.ordinal_position - 1 AS "database-position",
c.table_schema AS "table-schema",
c.table_name AS "table-name",
pk.column_name IS NOT NULL AS "pk?",
CASE
WHEN c.remarks <> '' THEN c.remarks
ELSE NULL
END AS "field-comment"
FROM
svv_columns AS c
LEFT JOIN (
SELECT
tc.table_schema,
tc.table_name,
kc.column_name
FROM
information_schema.table_constraints AS tc
INNER JOIN information_schema.key_column_usage AS kc
ON tc.constraint_name = kc.constraint_name
AND tc.table_schema = kc.table_schema
AND tc.table_name = kc.table_name
WHERE
tc.constraint_type = 'PRIMARY KEY'
) AS pk
ON c.table_schema = pk.table_schema
AND c.table_name = pk.table_name
AND c.column_name = pk.column_name
WHERE
c.table_schema !~ '^information_schema|catalog_history|pg_'
AND c.table_schema IN (

)
ORDER BY
"table-schema" ASC,
"table-name" ASC,
"database-position" ASC;
```

The schemas parameter is a set of schemas, and there's only one schema that is causing this (every schema is a federated postgres)

The customer also run the query in PyCharm and works, that's why we think this is an issue with the driver

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is identified in the report. Start by reproducing the supplied query with the Java driver and the affected federated PostgreSQL schema, then document a reliable failure case and the expected successful behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.