Ecto debug connection


I’m currently attempting to connect Ecto to materialize. Materialize is a postgres compatible streaming database, it supports the pgwire protocol and prepared statements. On connect an error displays:

failed to connect: ** (Postgrex.Error) ERROR 42601 (syntax_error) Expected left square bracket, found left parenthesis

Is there a way to debug the command/statement being sent to Materialize? log: :debug only provides query logs.

Unfortunately I’m not sure how to debug the command being sent but I have a hunch this might be related to the version output from Materialize. What does Materialize output as its version string?

It might be a good idea to raise an issue on the Postgrex repository since it appears to be failing before even getting to Ecto.

1 Like


select * version() gives me:
PostgreSQL 9.6 on x86_64-unknown-linux-gnu (materialized 0.6.0)

select mz_version()) gives me:
v0.6.0 (9ed7c170f))

You’re correct.

I was about to replicate the error displayed:
It comes from this bootstrap query link

SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
           coalesce(d.typelem, t.typelem), coalesce(r.rngsubtype, 0), ARRAY (
      SELECT a.atttypid
      FROM pg_attribute AS a
      WHERE a.attrelid = t.typrelid AND a.attnum > 0 AND NOT a.attisdropped
      ORDER BY a.attnum
    FROM pg_type AS t
    LEFT JOIN pg_type AS d ON t.typbasetype = d.oid
    LEFT JOIN pg_range AS r ON r.rngtypid = t.oid OR (t.typbasetype <> 0 AND r.rngtypid = t.typbasetype)
    WHERE (t.typrelid = 0)
        AND (t.typelem = 0 OR NOT EXISTS (SELECT 1 FROM pg_catalog.pg_type s WHERE s.typrelid != 0 AND s.oid = t.typelem))

Results in:

Query 1 ERROR: ERROR:  Expected left square bracket, found left parenthesis
LINE 2: ...ce(d.typelem, t.typelem), coalesce(r.rngsubtype, 0), ARRAY (
1 Like

Did you found any solution for this ? It would really be bad karma not to be able to use materialize with Phoenix…