9tigerio / db2rest

Instant low-code REST DATA API platform for databases. Connect any database, run anywhere.
https://db2rest.com
Apache License 2.0
210 stars 30 forks source link

ERROR: trailing junk after numeric literal at or near "0H" Position: 154 #727

Open kdhrubo opened 2 weeks ago

kdhrubo commented 2 weeks ago

The following query

SELECT t_re_33."id" ,t_re_33."name" ,t_re_33."display_name" ,t_re_33."deleted" ,t_re_33."display_order" ,t_re_33."storage_provider_id" FROM 0HEM8B0GQNB5M.t_region t_re_33

Leads to error Caused by: org.postgresql.util.PSQLException: ERROR: trailing junk after numeric literal at or near "0H" Position: 154

Solution : cover the schema name in quotes.

thadguidry commented 2 weeks ago

But I already said this: Best to always use quoted identifiers. See https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

  1. Quoted identifiers can contain any character except char(0).
  2. Maximum length of any identifier is 63 characters.
  3. And escaping, well for PostgreSQL, it ends up being entirely dependent on what the admin has configured the server encoding to (UTF-8, or not, etc.)
thadguidry commented 2 weeks ago
SELECT "t_re_33"."id",
       "t_re_33"."name",
       "t_re_33"."display_name",
       "t_re_33"."deleted",
       "t_re_33"."display_order",
       "t_re_33"."storage_provider_id"
FROM "0HEM8B0GQNB5M"."t_region" "t_re_33";
kdhrubo commented 2 weeks ago

Yes this was not done for schema and table name.

On Fri, Oct 4, 2024, 8:00 PM Thad Guidry @.***> wrote:

SELECT "t_re_33"."id", "t_re_33"."name", "t_re_33"."display_name", "t_re_33"."deleted", "t_re_33"."display_order", "t_re_33"."storage_provider_id"FROM "0HEM8B0GQNB5M"."t_region" "t_re_33";

— Reply to this email directly, view it on GitHub https://github.com/9tigerio/db2rest/issues/727#issuecomment-2394838816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAISPRE5PIVAFMJKWF3AGIDZZ42ZHAVCNFSM6AAAAABPM2GJZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUHAZTQOBRGY . You are receiving this because you authored the thread.Message ID: @.***>