Can't browse DB "Distinct, non-empty sequence of Field clauses"

Hello,

I have a similar scenario like in this post Unable to browse database tables and there was replied that it’s maybe because of the sync.

How long does it take to scan a large company database (aprox 500 tables) ?

I connected everything and when I try to access to a DB table I get the following error

“Distinct, non-empty sequence of Field clauses”

I checked the log and there says finished (after 30 sec or so), there is no more info or movement in the log.

I tried to force a Sync but the same.

Diagnostic info:

{
“browser-info”: {
“language”: “en-US”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“java.runtime.name”: “Java™ SE Runtime Environment”,
“java.runtime.version”: “1.8.0_181-b13”,
“java.vendor”: “Oracle Corporation”,
“java.vendor.url”: “http://java.oracle.com/”,
“java.version”: “1.8.0_181”,
“java.vm.name”: “Java HotSpot™ 64-Bit Server VM”,
“java.vm.version”: “25.181-b13”,
“os.name”: “Windows 8.1”,
“os.version”: “6.3”,
“user.language”: “en”,
“user.timezone”: “Europe/Paris”
},
“metabase-info”: {
“databases”: [
“h2”,
“mysql”,
“postgres”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
},
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
}
},
“run-mode”: “prod”,
“version”: {
“tag”: “v0.34.3”,
“date”: “2020-02-25”,
“branch”: “release-0.34.x”,
“hash”: “1a83edb”
},
“settings”: {
“report-timezone”: null
}
}
}

Part of the Log info:

[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T13:02:05+01:00 INFO metabase.sync.util FINISHED: step ‘sync-tables’ for postgres Database 65 ‘Mydatabase’ (640.7 ms)
[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T13:02:05+01:00 INFO metabase.sync.util STARTING: step ‘sync-fields’ for postgres Database 65 ‘Mydatabase’
[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T13:02:06+01:00 ERROR metabase.sync.util Error syncing Fields for Table ‘Table 3,917 ‘public.account_account’’: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
(“org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:280)”
“org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)”
“org.postgresql.jdbc.PgConnection.(PgConnection.java:195)”
“org.postgresql.Driver.makeConnection(Driver.java:458)”
“org.postgresql.Driver.connect(Driver.java:260)”
“java.sql.DriverManager.getConnection(Unknown Source)”
“java.sql.DriverManager.getConnection(Unknown Source)”
“clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)”
“clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)”
“clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)”
“clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)”
“clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1093)”
“clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1075)”
“clojure.java.jdbc$query.invokeStatic(jdbc.clj:1164)”
“clojure.java.jdbc$query.invoke(jdbc.clj:1126)”
“clojure.java.jdbc$query.invokeStatic(jdbc.clj:1142)”
“clojure.java.jdbc$query.invoke(jdbc.clj:1126)”
“–> driver.postgres$enum_types.invokeStatic(postgres.clj:100)”
“driver.postgres$enum_types.invoke(postgres.clj:97)”
“driver.postgres$fn__70635.invokeStatic(postgres.clj:113)”
“driver.postgres$fn__70635.invoke(postgres.clj:111)”
“sync.fetch_metadata$fn__51838$table_metadata__51843$fn__51844.invoke(fetch_metadata.clj:18)”
“sync.fetch_metadata$fn__51838$table_metadata__51843.invoke(fetch_metadata.clj:15)”
“sync.sync_metadata.fields.fetch_metadata$fn__52160$db_metadata__52165$fn__52166.invoke(fetch_metadata.clj:82)”
“sync.sync_metadata.fields.fetch_metadata$fn__52160$db_metadata__52165.invoke(fetch_metadata.clj:78)”
“sync.sync_metadata.fields$fn__52664$sync_fields_for_table_BANG___52673$fn__52679$fn__52681.invoke(fields.clj:91)”
“sync.util$do_with_error_handling.invokeStatic(util.clj:147)”
“sync.util$do_with_error_handling.invoke(util.clj:142)”
“sync.sync_metadata.fields$fn__52664$sync_fields_for_table_BANG___52673$fn__52679.invoke(fields.clj:90)”
“sync.sync_metadata.fields$fn__52664$sync_fields_for_table_BANG___52673.invoke(fields.clj:83)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715$iter__52716__52720$fn__52721$fn__52722.invoke(fields.clj:117)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715$iter__52716__52720$fn__52721.invoke(fields.clj:116)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715.invoke(fields.clj:116)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714.invoke(fields.clj:111)”
“sync.util$fn__43704$run_step_with_metadata__43709$fn__43713$fn__43715.invoke(util.clj:347)”
“sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)”
“sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)”
“sync.util$with_start_and_finish_debug_logging.invokeStatic(util.clj:119)”
“sync.util$with_start_and_finish_debug_logging.invoke(util.clj:116)”
“sync.util$fn__43704$run_step_with_metadata__43709$fn__43713.invoke(util.clj:344)”
“sync.util$fn__43704$run_step_with_metadata__43709.invoke(util.clj:339)”
“sync.util$fn__43896$run_sync_operation__43901$fn__43902$fn__43903.invoke(util.clj:432)”
“sync.util$fn__43896$run_sync_operation__43901$fn__43902.invoke(util.clj:432)”
“sync.util$fn__43896$run_sync_operation__43901.invoke(util.clj:426)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402$fn__53403$fn__53404.invoke(sync_metadata.clj:51)”
“sync.util$do_with_error_handling.invokeStatic(util.clj:147)”
“sync.util$do_with_error_handling.invoke(util.clj:142)”
“sync.util$do_with_error_handling.invokeStatic(util.clj:145)”
“sync.util$do_with_error_handling.invoke(util.clj:142)”
“driver$fn__22274.invokeStatic(driver.clj:524)”
“driver$fn__22274.invoke(driver.clj:524)”
“sync.util$sync_in_context$fn__43615.invoke(util.clj:138)”
“sync.util$with_db_logging_disabled$fn__43612.invoke(util.clj:129)”
“sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)”
“sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)”
“sync.util$with_start_and_finish_logging$fn__43601.invoke(util.clj:114)”
“sync.util$with_sync_events$fn__43596.invoke(util.clj:88)”
“sync.util$with_duplicate_ops_prevented$fn__43587.invoke(util.clj:67)”
“sync.util$do_sync_operation.invokeStatic(util.clj:166)”
“sync.util$do_sync_operation.invoke(util.clj:163)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402$fn__53403.invoke(sync_metadata.clj:50)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402.invoke(sync_metadata.clj:47)”
“api.database$fn__54071$fn__54073.invoke(database.clj:521)”)
[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T13:02:06+01:00 ERROR metabase.sync.util Error running sync step: Output of sync-fields-for-table! does not match schema:
(not (map? a-org.postgresql.util.PSQLException))
("–> sync.sync_metadata.fields$fn__52664$sync_fields_for_table_BANG___52673.invoke(fields.clj:83)"
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715$iter__52716__52720$fn__52721$fn__52722.invoke(fields.clj:117)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715$iter__52716__52720$fn__52721.invoke(fields.clj:116)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714$fn__52715.invoke(fields.clj:116)”
“sync.sync_metadata.fields$fn__52709$sync_fields_BANG___52714.invoke(fields.clj:111)”
“sync.util$fn__43704$run_step_with_metadata__43709$fn__43713$fn__43715.invoke(util.clj:347)”
“sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)”
“sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)”
“sync.util$with_start_and_finish_debug_logging.invokeStatic(util.clj:119)”
“sync.util$with_start_and_finish_debug_logging.invoke(util.clj:116)”
“sync.util$fn__43704$run_step_with_metadata__43709$fn__43713.invoke(util.clj:344)”
“sync.util$fn__43704$run_step_with_metadata__43709.invoke(util.clj:339)”
“sync.util$fn__43896$run_sync_operation__43901$fn__43902$fn__43903.invoke(util.clj:432)”
“sync.util$fn__43896$run_sync_operation__43901$fn__43902.invoke(util.clj:432)”
“sync.util$fn__43896$run_sync_operation__43901.invoke(util.clj:426)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402$fn__53403$fn__53404.invoke(sync_metadata.clj:51)”
“sync.util$do_with_error_handling.invokeStatic(util.clj:147)”
“sync.util$do_with_error_handling.invoke(util.clj:142)”
“sync.util$do_with_error_handling.invokeStatic(util.clj:145)”
“sync.util$do_with_error_handling.invoke(util.clj:142)”
“driver$fn__22274.invokeStatic(driver.clj:524)”
“driver$fn__22274.invoke(driver.clj:524)”
“sync.util$sync_in_context$fn__43615.invoke(util.clj:138)”
“sync.util$with_db_logging_disabled$fn__43612.invoke(util.clj:129)”
“sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)”
“sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)”
“sync.util$with_start_and_finish_logging$fn__43601.invoke(util.clj:114)”
“sync.util$with_sync_events$fn__43596.invoke(util.clj:88)”
“sync.util$with_duplicate_ops_prevented$fn__43587.invoke(util.clj:67)”
“sync.util$do_sync_operation.invokeStatic(util.clj:166)”
“sync.util$do_sync_operation.invoke(util.clj:163)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402$fn__53403.invoke(sync_metadata.clj:50)”
“sync.sync_metadata$fn__53397$sync_db_metadata_BANG___53402.invoke(sync_metadata.clj:47)”
“api.database$fn__54071$fn__54073.invoke(database.clj:521)”)
[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T13:02:06+01:00 INFO metabase.sync.util FINISHED: Sync metadata for postgres Database 65 ‘Mydatabase’ (6.0 s)

I see there is an error that says:

[b7480c8f-f82f-42bc-bc6c-2cd5b7851493] 2020-03-07T12:20:37+01:00 ERROR metabase.sync.util Error syncing Fields for Table ‘Table 3,917 ‘public.account_account’’: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

I connect to the DB via SSH, and I can see al my tables in the Browse area, so the connection seems to be done right. I granted all access for all the tables to user, in case it was that and I can access the same tables via DBeaver, but the error still persists.

Any Ideas?

Thanks in advance for your help.

Hi @comb
There’s a known issue when connecting via SSH (from within Metabase), so the workaround is to setup the tunnel manually.
https://github.com/metabase/metabase/issues/8396
https://github.com/metabase/metabase/issues/9278

Hi @flamber,

Thanks for the info!! that was it!

For other who have to do manual tunnel forwarding --> I’m using windows and tried to do it with Putty and it didn’t work, no forward was doing, tried turning off Firewall and other options, nothing helped, so changed the SSH Client to Bitvise and it worked!.

Remember that in metabase in the DB set up page, you have to write in port the one used to open from your computer (local)

Thanks.