Skip to content

Auto type Casting is wrong for custom type #260

@kislenko-artem

Description

@kislenko-artem

Little description:

I have table storage, storage has column f_size (type fsize), but method EQ support only string, when sql-query bulding, I got cast-error because library trying custom type compare with String.

``


table.Storage.
SELECT(table.Storage.AllColumns).
WHERE(
  table.Storage.FSize.EQ(postgres.String("original")).
  AND(
     table.Storage.CreatedBy.EQ(postgres.UUID(u.ID)).OR(table.Storage.CreatedBy.IS_NULL())
  )
)
		

Query (builed by library):

sqlStatment 
SELECT storage.id AS "storage.id",
     storage.created_at AS "storage.created_at",
     storage.name AS "storage.name",
     storage.path AS "storage.path",
     storage.f_type AS "storage.f_type",
     storage.parent_id AS "storage.parent_id",
     storage.f_size AS "storage.f_size",
     storage.created_by AS "storage.created_by"
FROM public.storage
WHERE (storage.f_size = 'original'::text) AND (
 (storage.created_by = '50cb0a24-0000-4c8c-93ad-4137c4087662') OR storage.created_by IS NULL);

Error:

 jet: pq: operator does not exist: public.fsize = text

So error in this line: storage.f_size = 'original'::text

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions