Metabase-gemerated SQL inspection

Is there a way to determine exactly what SQL is being emitted from a question? When I try to use a filter (with a value), my SQL is failing with the message “ERROR: invalid reference to FROM-clause entry for table “product_version” Hint: Perhaps you meant to reference the table alias “pv”. Position: 507”. It appears as if it is dropping the alias from my query, but I can’t tell without seeing exactly what’s being sent to my database (PostgreSQL 12).

I also had this recently.
Are u using joins ?
I think i had it when i summarized on a column from a joined table.

Yes, it is a 5 table join, hence the use of the aliases. I guess I could try it with the schema and column names hard-coded into the query - but I’m really trying generally to see what Metabase is sending so that I can debug this issue. Thanks for the response.

Hi @PeteS
Are you using Field Filters? If yes, you cannot use table aliases:
https://www.metabase.com/learn/building-analytics/sql-templates/field-filters.html
https://github.com/metabase/metabase/issues/3324 - upvote by clicking :+1: on the first post

There’s currently no built-in function to see the SQL, but you can open your browser developer Network-tab and click the request to see the response data, which has the query.
https://github.com/metabase/metabase/issues/6096 - upvote by clicking :+1: on the first post

Excellent information, thank you so much.