Skip to content

HashId key - not existing record & PostgreSQL database bug #122

@bbprojectnet

Description

@bbprojectnet

Hello,

I'm using hashid for me keys:

HashId::make()->alreadyHashed(),

In that setup, when you try to GET not existing record (for example with some random string as a key in url), function \LaravelJsonApi\HashIds\HashId::decode() return null which leads to database error:

[2021-09-08 10:58:08] local.ERROR: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type bigint: "" (SQL: select * from "users" where "users"."id" =  and "users"."deleted_at" is null and "activated_at" is not null limit 1)

because PostgreSQL is very sensitive for that situation, when we try to compare bigint with string or null.

It's works fine in MySQL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions