Mariaex prepared statements error


I’m facing some trouble with prepared statements in MySQL.

Whenever I try to run queries on some tables/views, I get the following error:

** (exit) an exception was raised:
    ** (Mariaex.Error) (1615): Prepared statement needs to be re-prepared
        (ecto) lib/ecto/adapters/sql.ex:436: Ecto.Adapters.SQL.execute_and_cache/7
        (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
        (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4
        (ecto) lib/ecto/repo/queryable.ex:68:
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) /code/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

Reading it online, I found that this has to do with some problem at the database level, and my options are fixing the db or disabling prepared statements, but I have zero access to change the db configuration.

I looked arround at the Ecto, Mariaex and DBConnection codebase I could not find a way to disable it.

I am willing to make a PR creating a new configuration, but I’m kind off clueless on how or where to do it.

Does anyone have any tips for me?

1 Like

An example of the kind of query you’re running would likely facilitate debugging.

1 Like

It’s a simple select with a left join in a view.

The thing that’s causing the error is the database itself, so a sample select will not help much, since I have no authorization to make any adjustments on the database level.

Just to clarify, we have a clone of the production database that is used for staging purposes, and it works flawlessly on it. The error only occurs on the production server.

1 Like

I’m not sure about the error, so won’t be much of a help here, but I can say that disabling prepared statements won’t work because they are essential to the architecture of ecto.

1 Like