Hey there,
I've been using Metabase at my small company for about 2 months. I've been able to build and run native SQL queries just fine, but whenever I try to use the querybuilder features the Metabase server crashes with a Postgres syntax error.
Specifically, when I go to 'Ask a question' -> 'Custom' -> I select a table to start, the client sends an AJAX request that gets a 500 response. The URL of the request is 'https://my-metabase-deployment.herokuapp.com/api/automagic-dashboards/database/2/candidates' and it returns the following:
{"message":"ERROR: syntax error at or near \"NULL\"\n Position: 84","type":"class org.postgresql.util.PSQLException","stacktrace":["org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)","org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)","org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)","org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)","org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)","org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)","org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:118)","com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:353)","clojure.java.jdbc$execute_query_with_params.invokeStatic(jdbc.clj:1002)","clojure.java.jdbc$execute_query_with_params.invoke(jdbc.clj:996)","clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1025)","clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1005)","clojure.java.jdbc$query.invokeStatic(jdbc.clj:1099)","clojure.java.jdbc$query.invoke(jdbc.clj:1056)","toucan.db$query.invokeStatic(db.clj:275)","toucan.db$query.doInvoke(db.clj:271)","clojure.lang.RestFn.invoke(RestFn.java:410)","--> automagic_dashboards.core$enhance_table_stats.invokeStatic(core.clj:1231)","automagic_dashboards.core$enhance_table_stats.invoke(core.clj:1209)","automagic_dashboards.core$candidate_tables.invokeStatic(core.clj:1270)","automagic_dashboards.core$candidate_tables.invoke(core.clj:1250)","automagic_dashboards.core$candidate_tables.invokeStatic(core.clj:1260)","automagic_dashboards.core$candidate_tables.invoke(core.clj:1250)","api.automagic_dashboards$fn__46725.invokeStatic(automagic_dashboards.clj:59)","api.automagic_dashboards$fn__46725.invoke(automagic_dashboards.clj:56)","middleware$enforce_authentication$fn__56174.invoke(middleware.clj:113)","api.routes$fn__56318.invokeStatic(routes.clj:61)","api.routes$fn__56318.invoke(routes.clj:61)","routes$fn__56409$fn__56410.doInvoke(routes.clj:108)","routes$fn__56409.invokeStatic(routes.clj:103)","routes$fn__56409.invoke(routes.clj:103)","middleware$catch_api_exceptions$fn__56309.invoke(middleware.clj:436)","middleware$log_api_call$fn__56287$fn__56289.invoke(middleware.clj:364)","middleware$log_api_call$fn__56287.invoke(middleware.clj:363)","middleware$add_security_headers$fn__56229.invoke(middleware.clj:252)","core$wrap_streamed_json_response$fn__62673.invoke(core.clj:67)","middleware$bind_current_user$fn__56179.invoke(middleware.clj:137)","middleware$maybe_set_site_url$fn__56239.invoke(middleware.clj:290)","middleware$add_content_type$fn__56232.invoke(middleware.clj:262)"],"sql-exception-chain":["PSQLException:","Message: ERROR: syntax error at or near \"NULL\"","Position: 84","SQLState: 42601","Error Code: 0"]}
I can see a similar error message in the server logs. Once this happens, no columns show up in UI to build the query with:
I'm running Metabase 0.31.2 on Heroku. I just upgraded from 0.31.1, but I was having this problem before upgrading. For the database itself, I'm running Postgres 9.6.6 on AWS RDS.
As an update - I can also reproduce this by trying to analyze a native query.
Anyone have any thoughts?