Enable to research on a specific table

Hi,

I’m in Alix_Bouloc team,

here’s a quick update on this issue, we found the cause. Maybe sharing the solution will help someone in a similar case.

Symptom

Unexpected error: function lower(uuid) does not exist

By looking at the error log, we can see a sql key in the error object.

query was looking like the following snippet (simplified version)

SELECT
  *
FROM
  public.users AS users
  LEFT OUTER JOIN public.accounts AS account ON users.account_id = account.id
WHERE
  lower(users.medok_sub) LIKE lower('antoine')

By running the query on my database, I’ve got the same error.

Indeed, users.medok_sub is a uuid column, so there’s no like functions on uuid type

Solution

On models, we turned this

const User = sequelize.define(
    'users',
   { medokSub: {type: DataTypes.STRING})

into this

const User = sequelize.define(
    'users',
   { medokSub: {type: DataTypes.UUID})

Open points

Why there was a mismatch ? It’s surely on our side
How to debug this faster, ask the complete error log

Anyway guys, thanks for your help and your tool :slight_smile:

1 Like