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.

Casting of values causes query errors

See original GitHub issue

Hi,

We’re using this package to connect to our Aurora serverless database cluster. For testing, we use a local Postgres database and everything works fine. The transformParameters in the PostgresQueryTransformer incorrectly assumes that our string (which is a valid UUID) should be cast to type uuid. The column we’re querying is in fact a character varying (regular string) as it does not only store UUIDs but also other strings.

Because of this incorrect assumption, we are unable to query our database when the parameter we’re using is formatted as an UUID.

Another issue is that we’ve got a column specified as @Column('json') content: SomeType; which works fine with a regular Postgres connection, but we’re prompted with the following error when trying to insert data: ERROR: column "content" is of type json but expression is of type character varying

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ArsenyYankovskycommented, Apr 24, 2021

@seawatts I decided to remove the UUID hack as it does more harm than good. It is removed in the 2.1.0 version of the driver.

0reactions
seawattscommented, Apr 24, 2021

Wow thanks @ArsenyYankovsky! I’ll try it out soon and let you know. If this works I’ll be able to finally set up my serverless DB in prod 😁🚀 you’re the man!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL CAST causes Arithmetic Overflow Error even when row is ...
The following query should work: SELECT Id, CAST(value AS DECIMAL(6,1)) FROM <complex number of joins> WHERE <conditions that don't return ...
Read more >
CAST throwing error when run in stored procedure but not ...
The query in question was running a clustered seek on an index that covered the date but not the identifier this caused it...
Read more >
Query fails with SQL0420 error - IBM
This error can occur during the runtime data retrieval process for a query with multiple predicates when an unsupported attempt is made to...
Read more >
Type Casting in SQL | Towards Data Science
Ccasting from one type to another is very common in SQL queries. The use stems basically from bad database design, changing requirements, ...
Read more >
CAST function
Types B O O L E A N S M A L L I N T I N T E G E R...
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