I have a standard listings table in a Redshift table with all varchars (due to loading into the database)
This query (simplified) gives me an error:
with AL as ( select L.price::int as price, from listings L where L.price <> 'NULL' and L.listing_type <> 'NULL' ) select price from AL where price < 800
and error:
----------------------------------------------- error: Invalid digit, Value 'N', Pos 0, Type: Integer code: 1207 context: NULL query: 2422868 location: :0 process: query0_24 [pid=0] -----------------------------------------------
If I delete the condition where price < 800 , the request will return just fine ... but I need the condition to be there.
I also checked the validity of the number of the price field, and everything looks good.
After the game, it actually makes it work, and I canβt explain why.
with AL as ( select L.price::int as price, from listings L where L.price <> 'NULL' and L.listing_type <> 'NULL' limit 10000000000 ) select price from AL where price < 800
Please note that the table has much fewer entries than the number indicated in the limit.
Can someone (possibly from a Redshift engineer) explain why this is so? Perhaps something has to do with how the query plan is executed and parallelized?
source share