Can't refresh materialized view with ormlite - servicestack

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.

Related

Why this errot coming on page refreshing in acumatica. {"Message":"An error has occurred."}

SELECT [r_MUIUserScreenRelevance].[UserID] AS [MUIUserScreenRelevance_UserID], [r_MUIUserScreenRelevance].[NodeID] AS [MUIUserScreenRelevance_NodeID], [r_MUIUserScreenRelevance].[Relevance] AS [MUIUserScreenRelevance_Relevance]
FROM [MUIUserScreenRelevance] [r_MUIUserScreenRelevance]
WHERE [r_MUIUserScreenRelevance].[UserID] = CONVERT(UNIQUEIDENTIFIER, 'b5344897-037e-4d58-b5c3-1bdfd0f47bf9') AND ( [r_MUIUserScreenRelevance].[CompanyID] = 2)
ORDER BY [r_MUIUserScreenRelevance].[UserID], [r_MUIUserScreenRelevance].[NodeID] OPTION(OPTIMIZE FOR UNKNOWN)
at Serilog.Core.Logger.Write(LogEventLevel level, Exception exception, String messageTemplate, Object[] propertyValues)
at Serilog.Core.Logger.Information[T](String messageTemplate, T propertyValue)
An error has occurred during your processing. You need to review the Trace log and most likely will find the error on one of the trace items. Alternatively, switch on the Request Profiler and reprocess what you tried on the above. What changes were made that caused this - I find retracing your steps on each change made backwards will point you in the right direction.

Acumatica - Error when upgrading to 2020R2 - Workspace menu items disappear

We are encountering an error when upgraded to 2020R2, specifically from 2020R1 (Build 20.109.0032) to 2020R2 (Build 20.204.0032).
Upon successful login, the user is taken to the Default page (ScreenID = 00000000) and receives the error "Object reference not set to an instance of an object." popup message. When dismissed, the page renders its Welcome information, but the left-hand Workspaces and menu items (Finance, Sales Orders, Receivables, etc.) have disappeared, instead showing a spinning icon. Quick Search at page top offers no menu items when searched.
The user can manually enter any page (eg. ScreenID=SO301000) directly into the Address URL and reach the page content, but again initially gets the error and has no workspace menus.
There is nothing in the Trace to give clues. However, the browser's Web Console give details as shown below:
XHRGEThttp://localhost/AcumaticaERP/(W(1))/frameset/sitemap
[HTTP/1.1 500 Internal Server Error 912ms]
Message "An error has occurred."
ExceptionMessage "Object reference not set to an instance of an object."
ExceptionType "System.NullReferenceException"
StackTrace " at PX.Web.UI.Frameset.Services.AccessProvider.ApplyRestrictionsForCurrentUser(Screen screen)\r\n at PX.Web.UI.Frameset.Services.SiteMapRepository.<>c__DisplayClass21_0.<GetSiteMapImpl>b__10(Screen s)\r\n at AutoMapper.Mapper.AutoMapper.IMapper.Map(Object source, Type sourceType, Type destinationType, Action`1 opts)\r\n at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source, Action`1 opts)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n at System.Li…HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"
If I place a breakpoint in VS2019 at the beginning of Page_Init() of PageTitle.ascx.cs, the error occurs first, then the breakpoint is reached:
protected void Page_Init(object sender, EventArgs e)
{
var lifetimeScope = this.Context.GetLifetimeScope(); <-- set a breakpoint here
if (lifetimeScope != null)
{
screenRepository = lifetimeScope.Resolve<IScreenRepository>();
}
else
....
A similar upgrade of a demo website and database with Sales Demo data works just fine.
We conducted a SQL Schema Compare of the two databases and opted to Update the differences, which were all examples of moving away from the NoteID column allowing NULL in many tables.
The schemas are now the same, the website upgrades are the same, so now I suspect it is the data... somewhere... causing a lack of workspace and menus.
The call to PX.Web.UI.Frameset.Services.AccessProvider.ApplyRestrictionsForCurrentUser() seems to be the issue but is data-related in my case. It's as if AccessProvider of screenRepository isn't available yet in a different control upstream from use of PageTitle.ascx?
Where can I look next to try to resolve?
Thank you.

SharePoint Search 2013 crawls stuck - never commit

SharePoint 2013 search crawls getting stuck for one content source with index count around 300K. When I kick off crawls the success count grows pretty steadily and performance is not an issue. The small content source with 5-7K index would finish fine. This is started recently. The problem I suspect is, search process never commits the transaction. Here is the ULS error.
mssearch.exe (0x0FA8) 0x39D0 SharePoint Server Search Crawler:Gatherer Plugin ac6s7 High ManagedSqlSession caught a SqlException executing the following command: 'proc_MSS_CommitTransactions'. Connection string was: 'Data Source=XXXXX;Initial Catalog=SSA_CrawlStoreDB;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15;Application Name=SharePoint[OWSTIMER][1][SSA_CrawlStoreDB]' Original exception message: 'Arithmetic overflow error for data type smallint, value = 32768. Duplicate key was ignored.' Stack trace ' at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParser...
Detailed error posted on my blog
http://nitrohn.blogspot.com/2016/10/sharepoint-2013-search-crawl.html
Any ideas how to fix?

Web Api Returning Json - [System.NotSupportedException] Specified method is not supported. (Sybase Ase)

I'm using Web api with Entity Framework 4.2 and the Sybase Ase connector.
This was working without issues returning JSon, until I tried to add a new table.
return db.car
.Include("tires")
.Include("tires.hub_caps")
.Include("tires.hub_caps.colors")
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
.Where(c => c.tires == 13);
The above works without issues if the following line is removed:
.Include("tires.hub_caps.colors")
However, when that line is included, I am given the error:
""An error occurred while preparing the command definition. See the inner exception for details."
The inner exception reads:
"InnerException = {"Specified method is not supported."}"
"source = Sybase.AdoNet4.AseClient"
The following also results in an error:
List<car> cars = db.car.AsNoTracking()
.Include("tires")
.Include("tires.hub_caps")
.Include("tires.hub_caps.colors")
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
.Where(c => c.tires == 13).ToList();
The error is as follows:
An exception of type 'System.Data.EntityCommandCompilationException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: An error occurred while preparing the command definition. See the inner exception for details.
Inner exception: "Specified method is not supported."
This points to a fault with with the Sybase Ase Data Connector.
I am using data annotations on all tables to control which fields are returned. On the colors table, I have tried the following annotations to limit the properties returned just the key:
[JsonIgnore]
[IgnoreDataMember]
Any ideas what might be causing this issue?
Alternatively, if I keep colors in and remove,
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
then this works also. It seems that the Sybase Ase connector does not support cases when an include statement forks from one object in two directions. Is there a way round this? The same issue occurs with Sybase Ase and the progress data connector.
The issue does not occur in a standard ASP.net MVC controller class - the problem is with serializing two one to many relationships on a single table to JSON.
This issue still occurs if lazy loading is turned on.
It seems to me that this is a bug with Sybase ASE, that none of the connectors are able to solve.

Not able to create Information link in Spotfire

I am trying to create an Information link in Spotfire Information designer and keep getting this error. I can access the database and the validated columns as well as database. Any help is really appreciated.
` Error message: Could not open information link.
TargetInvocationException at Spotfire.Dxp.Framework:
Exception has been thrown by the target of an invocation. (HRESULT: 80131604)
Stack Trace:
at Spotfire.Dxp.Framework.ApplicationModel.ProgressService.ExecuteWithProgress(String title, String description, ProgressOperation operation)
at Spotfire.Dxp.Forms.Data.InformationDesigner.DesignerFormController.ExecuteInformationLink(CachedInformationLinkElement informationLink)
ImportException at Spotfire.Dxp.Data:
Failed to execute data source query. (HRESULT: 80131500)
Stack Trace:
at Spotfire.Dxp.Data.DataSourceConnection.ExecuteQuery2()
at Spotfire.Dxp.Data.DataFlow.Execute()
at Spotfire.Dxp.Data.DataFlow.DataFlowConnection.ExecuteQueryCore2()
at Spotfire.Dxp.Data.DataSourceConnection.ExecuteQuery2()
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.<>c__DisplayClass11.<GetColumnsAndProperties>b__e()
at Spotfire.Dxp.Framework.ApplicationModel.Progress.ExecuteSubtask(String title, ProgressOperation operation)
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.GetColumnsAndProperties(DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataItem.PerformUpdate(SourceColumnProducer producer, DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataItem.Update(SourceColumnProducer producer, DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataPool.<LoadData>d__1.MoveNext()
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.ConfigureAndLoadData()
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<ConfigureSubTree>b__10(Node node)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<ConfigureSubTree>b__10(Node node)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<ConfigureSubTree>b__10(Node node)
at Spotfire.Dxp.Framework.DocumentModel.State.NodeState.ForEachChild(IDocumentNodeChild[] children, Action`1 action)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.ApplicationModel.Progress.ExecuteSubtask(String title, IndeterminateProgressFormatter progressFormatter, ProgressSpeedFormatter speedFormatter, ProgressOperation operation)
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.ConfigureAndAttachFromNew()
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.AttachSubTreeWhileExecuting(UndoableNode newOwner)
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.AttachToUndoableNode(UndoableNode newOwner)
at Spotfire.Dxp.Framework.DocumentModel.UndoableKeyedCollection`2.<>c__DisplayClass6.<Insert>b__5()
at Spotfire.Dxp.Framework.DocumentModel.Node.Spotfire.Dxp.Framework.DocumentModel.INode.InternalTransaction(Executor executor)
at Spotfire.Dxp.Framework.DocumentModel.UndoableKeyedCollection`2.Insert(Int32 index, TNode item)
at Spotfire.Dxp.Data.DataTableCollection.<>c__DisplayClass11.<Add>b__10()
at Spotfire.Dxp.Framework.DocumentModel.Node.Spotfire.Dxp.Framework.DocumentModel.INode.InternalTransaction(Executor executor)
at Spotfire.Dxp.Data.DataTableCollection.Add(String dataTableName, DataSource dataSource, Boolean autoCreateFilters)
at Spotfire.Dxp.Application.PartiallyOpenedDataSource.<LoadData>d__0.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.<OpenPartiallyOpenedDocument>d__34.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.<OpenDataSource>d__1b.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.ConsumePromptRequests(IEnumerable`1 prompts)
at Spotfire.Dxp.Application.AnalysisApplication.Open(DataSource source, DocumentOpenSettings settings)
at Spotfire.Dxp.Forms.Data.Import.DataSourceFactoryService.OpenDataSourceWithoutPrompting(DataSource dataSource, DocumentOpenSettings documentOpenSettings, IServiceProvider serviceProvider)
at Spotfire.Dxp.Forms.Data.Import.DataSourceFactoryService.OpenDataSource(InformationLinkDataSource dataSource, DocumentOpenSettings documentOpenSettings, IServiceProvider serviceProvider)
at Spotfire.Dxp.Forms.Data.InformationDesigner.DesignerFormController.<>c__DisplayClass2.<ExecuteInformationLink>b__0()
at Spotfire.Dxp.Forms.Application.FormsProgressService.ProgressThread.DoOperationLoop()
InformationModelException at Spotfire.Dxp.Data:
An Internal Error has occurred. com.spotfire.ws.dat.OperatorException: unexpected exception (HRESULT: 80131500)
Stack Trace:
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.GetNextBlock()
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Spotfire.Dxp.Internal.Utilities.SeekableStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt16()
at Spotfire.Dxp.Data.Formats.Sbdf.SbdfSectionHeader.ReadSectionType(BinaryReader reader, SbdfSectionTypeId expectedType)
at Spotfire.Dxp.Data.Import.SbdfDataRowReader.DelayedInit()
at Spotfire.Dxp.Data.Import.InformationLinkDataSourceConnection.ExecuteQueryCore2()
at Spotfire.Dxp.Data.DataSourceConnection.ExecuteQuery2()
InformationModelServiceException at Spotfire.Dxp.Services:
An Internal Error has occurred. com.spotfire.ws.dat.OperatorException: unexpected exception (HRESULT: 80131509)
Stack Trace:
at Spotfire.Dxp.Services.WebServiceBase`1.InvokeService[T](ServiceMethod`1 serviceMethod, ExceptionFactoryMethod exceptionFactoryMethod)
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.GetNextBlock()`
Edit the information Link and validate the data types of each column. The most common scenario is a DATE column being set as a LongInteger in Spotfire.
Do you have an access to the database logs as it could be helpful here I think. There is a similar post with resolution based on modification of permissions. Spotfire accessed the db via a user that might not have permissions to db and I am not talking about the db user you provided and verified but more about a .NET user used by Spotfire.
What version of Spotfire are you running?
If you have access to the Spotfire logs, you should have a server.log and a sql.log.
You should be able to identify the exact query that Spotfire is executing within the sql.log - since it failed it should appear with your user id, information link name and it should be noted as cancelled.
The exact database error should be in the server.log with a timestamp that corresponds to the sql.log cancelled timestamp.

Resources