Error after restoring database

I have a connection to a PSQL Server. I dropped the database and restored it. Now my Data Connection does not work and comes up with the following error.

The connection could not be established: Column ‘fk_table_name’ is null.

The connection string has not changed. I am not sure what fk_table_name is, I don’t believe that is in my database anywhere.

I also tried setting up a new data connection to that server and I get the same error

image

Additional logging.

	Error while loading structure of the data source [D:DB225889-411E-47BD-A522-41160DD5385F]: System.InvalidCastException: Column 'fk_table_name' is null.
   at Npgsql.ThrowHelper.ThrowInvalidCastException_NoValue(FieldDescription field)
   at Npgsql.NpgsqlDataReader.GetFieldValue[T](Int32 ordinal)
   at combit.Reporting.DataProviders.NpgsqlConnectionDataProvider.Init()
   at combit.Reporting.DataProviders.DbConnectionDataProvider.get_Tables()
   at combit.ReportServer.Worker.ExportHelper.InitiateDataProviders(ReportTemplate template, DataSourceModes dataMode, TempDir tempDir, Action`1 tableHandler)

What is it doing in the get_Tables() function?

Additional info, the original database I just renamed, and I can still connect to that. It is just the new one. Is it caching table names somewhere?

The provider"s code is open sourced here:

Maybe you can write a small test app using the code to connect to your database? Otherwise, we’ll need your database for analysis. From the log, it looks like an inconsistent relationship configuration. The error probably results from this query:

string commandText = "SELECT a.table_name AS pk_table_name, a.column_name AS pk_colum_name, b.table_name AS fk_table_name, b.column_name AS fk_colum_name, a.table_schema, b.table_schema FROM information_schema.referential_constraints LEFT JOIN information_schema.key_column_usage AS a ON referential_constraints.constraint_name = a.constraint_name LEFT JOIN information_schema.key_column_usage AS b ON referential_constraints.unique_constraint_name= b.constraint_name";

That query pointed out some messed up relationships, thank you, I will get those resolved.

1 Like