Used with GORM resulting in errors for simple queries. May be relate to column name not lowercase
result := db.First(&Request{}, "Token = ?", request.Token)
Results in: Syntax error near . " token"
using Postgres driver as instructed
Seems to actually be related to #62
@pkordes could you post the raw SQL query your Gorm is doing? Would help knowing if it's linked to #62 or not.
Thank you,
I would if I knew how to see that. I dove into the GORM code and there isn't anywhere that it shows me the SQL it is creating. The reason that I believe it is related is that I removed the conditional above and it is explicitly giving a Syntax error on a quote " ... this leads me to believe it is the same issue. You can see my line of code where we are doing a .First function on the driver and supplying the request model that would be filled.
I managed to output the sql queries but it is still failing. I am happy to try and fix for you but I don't know how to break into a debugger for this code. stepping through my code it gets into GORM but not into your driver code.
SELECT * FROM "requests" WHERE Token = 'token1238' ORDER BY "requests"."token" LIMIT 1
- attribute Token does not exist in table requests (it does and works fine with dockerized postgres)
SELECT * FROM "guard_rails" WHERE "guard_rails"."name" IN (NULL)
- Syntax error near ( null )
SELECT * FROM "accounts" WHERE "accounts"."id" = '11223333' ORDER BY "accounts"."id" LIMIT 1
- Error finding account id: 11223333 with error: Syntax error near ( null )
SELECT * FROM "requests" WHERE ID = '4cacb10dd' ORDER BY "requests"."token" LIMIT 1
- attribute ID does not exist in table requests
These are just a few examples. Please tell me how to debug into the code and I can look into fixing
This was with the fix for #62.