db2rest icon indicating copy to clipboard operation
db2rest copied to clipboard

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

Open kdhrubo opened this issue 1 year ago • 3 comments

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.

kdhrubo avatar Oct 05 '24 00:10 kdhrubo

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 avatar Oct 05 '24 00:10 thadguidry

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";

thadguidry avatar Oct 05 '24 00:10 thadguidry

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: @.***>

kdhrubo avatar Oct 05 '24 01:10 kdhrubo