Foreign Catalog refresh

Dnirmania
Contributor

Hi Everyone

I have recently created one Foreign catalog from AWS Redshift in databricks and I could see some tables too but when I ran REFRESH FOREIGN SCHEMA command, it failed with following error. I tried to search about it online but didn't get anything helpful. 

error: single-row subquery returns more than one row code: 8001 context: card_check query: 84022749 location: funcs_int.cpp:132 process: query0_123_84022749 [pid=15019]

Any help with this issue is highly appreciated.

Thanks,

Dinesh

Alberto_Umana
Databricks Employee
Databricks Employee

Hello @Dnirmania,

The error message "single-row subquery returns more than one row" indicates that a subquery used in your REFRESH FOREIGN SCHEMA command is expected to return only one row, but it is returning multiple rows. This is a common SQL error that occurs when a subquery is used in a context where only a single value is expected, but the subquery returns multiple values.

Ensure that the subquery returns only one row. You can do this by:

  • Using an aggregate function like MAX(), MIN(), or TOP 1 to limit the result to a single row.
  • Adding a WHERE clause to filter the results so that only one row is returned.

Check for Duplicates: If the subquery is supposed to return a unique value, ensure that there are no duplicate values in the data that the subquery is querying.

Dnirmania
Contributor

REFRESH FOREIGN SCHEMA is databricks command to refresh foreign catalog and I don't have visibility about the queries which its runs internally.