I have updated ServiceStack to latest version on a project and now this line seems to be giving me issues:
_db.ExecuteNonQuery("REFRESH MATERIALIZED VIEW product_book;");
It generates this error in logs:
2020-08-25 23:14:26.8896||DEBUG|OrmLiteResultsFilterExtensions|SQL: REFRESH MATERIALIZED VIEW product_book; |url: |action: 2020-08-25 23:17:19.6129||ERROR|ImportBookHelper|Error reading xml Npgsql.PostgresException (0x80004005): 42P01: relation "product_book" does not exist at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 973 --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 449 at Npgsql.NpgsqlDataReader.NextResult() in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 298 at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1178 at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 977 at Npgsql.NpgsqlCommand.ExecuteNonQuery() in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 959 at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExecNonQuery(IDbCommand dbCmd, String sql, Object anonType) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteResultsFilterExtensions.cs:line 32 at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteExecFilter.cs:line 64 Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "product_book" does not exist File: namespace.c Line: 407 Routine: RangeVarGetRelidExtended|url: |action:
I have tried running
REFRESH MATERIALIZED VIEW product_book; in the postgresql console and it runs fine. I have also tried using
ExecuteSql() but always the same issue.
It says relation doesn't exist but it does. Also the connection string is definitely to the right database and it can read/write fine.
This used to work but now it seems to have stopped working and I can't figure out why.
This isn't going to be an issue with OrmLite which just sends the SQL as-is to Npgsql ADO.NET provider which is returning the server PostgreSQL error.
For some reason the connection string doesn't have visibility or access to your
product_book materialized view, some potential issues could be the user may not have access to it, or it's in a different schema.
User contributions licensed under CC BY-SA 3.0