0

I'm trying to connect my MS Excel 2013 Pro+ with PostgreSQL DB using Power Query and Npgsql connector.

Everything seems to be fine, until - I'll try to run custom query (eg. select * from table). Then - there's an error message coming up: "The specified cas is not valid". If I'll use the DB structure browser - I'm able to select table or view and hit 'Load' but it's also giving me same error.

Is there something I do wrong, or is there some bug in the connector?

Here's the stacktrace from Excel:

Feedback Type:

Frown (Error)

Timestamp: 2017-08-21T09:14:00.7435203Z

Local Time: 2017-08-21T11:14:00.7435203+02:00

Product Version: 2.48.4792.941 (PQ-CY17SU07) (x86)

Release: July, 2017

Excel Version: 15.0.4420.1017

Excel Install Location: C:\Program Files\Microsoft Office\Office15\EXCEL.EXE

IE Version: 11.0.9600.17843

OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1 (x86 pl-PL)

CLR Version: 4.6.1 or later [Release Number = 394271]

Workbook Package Info: 1* - en-US, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Peak Working Set: 268 MB

Private Memory: 231 MB

Peak Virtual Memory: 930 MB

Error Message: Specified cast is not valid.

Stack Trace: Microsoft.Mashup.Evaluator.Interface.ErrorException: Specified cast is not valid. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Specified cast is not valid. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Specified cast is not valid. ---> System.InvalidCastException: Specified cast is not valid. ---> System.InvalidCastException: Specified cast is not valid. at Microsoft.OleDb.Serialization.PageWriter.WriteSchema(DataTable schemaTable) at Microsoft.OleDb.Serialization.OleDbPageWriter..ctor(Stream stream, DataTable schemaTable) at Microsoft.Mashup.Evaluator.RemotePageReader.<>c__DisplayClass7.b__0() at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.EvaluationHost.<>c__DisplayClass7.b__6() at Microsoft.Mashup.Common.SafeExceptions.IgnoreSafeExceptions(IEngineHost host, IHostTrace trace, Action action) at Microsoft.Mashup.Evaluator.EvaluationHost.TryReportException(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Exception exception) at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) at Microsoft.Mashup.Evaluator.RemotePageReader.RunStub(IEngineHost engineHost, IMessageChannel channel, Func1 getPageReader) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>c__DisplayClass11.<OnBeginGetDataReaderSource>b__f(EvaluationResult21 result) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>c__DisplayClass1e1.<OnBeginGetResult>b__1b() at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetResult[T](IMessageChannel channel, BeginGetResultMessage message, Action1 action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetDataReaderSource(IMessageChannel channel, BeginGetDataReaderSourceMessage message) at Microsoft.Mashup.Evaluator.MessageHandlers.<>c__DisplayClassa1.<AddHandler>b__8(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.OnMessageWithUnknownChannel(IMessageChannel baseChannel, MessageWithUnknownChannel messageWithUnknownChannel) at Microsoft.Mashup.Evaluator.MessageHandlers.<>c__DisplayClassa1.b__8(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.EvaluationHost.Run() at Microsoft.Mashup.Container.EvaluationContainerMain.Run(Object args) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass2.b__0(Object o) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass15.b__14(Object o) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass2.b__1(Object o) at Microsoft.Mashup.Container.EvaluationContainerMain.SafeRun(String[] args) at Microsoft.Mashup.Container.EvaluationContainerMain.Main(String[] args) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.EvaluationHost.OnException(IEngineHost engineHost, IMessageChannel channel, ExceptionMessage message) at Microsoft.Mashup.Evaluator.RemoteEvaluationContainerFactory.Container.OnException(IMessageChannel channel, ExceptionMessage message) at Microsoft.Mashup.Evaluator.MessageHandlers.<>c__DisplayClassa1.<AddHandler>b__8(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.Interface.IMessageChannelExtensions.WaitFor[T](IMessageChannel channel) at Microsoft.Mashup.Evaluator.MessageBasedInputStream.ReadNextChunkAndCheckIfClosed() at Microsoft.Mashup.Evaluator.MessageBasedInputStream.ReadNextChunk() at Microsoft.Mashup.Evaluator.ChunkedInputStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.BinaryReader.FillBuffer(Int32 numBytes) at System.IO.BinaryReader.ReadInt32() at Microsoft.Mashup.Evaluator.ITableSourceSerializationExtensions.ReadITableSource(BinaryReader reader) at Microsoft.Mashup.Evaluator.RemotePageReader.CreateProxy(IEngineHost engineHost, IMessageChannel channel, ExceptionHandler exceptionHandler) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.DataReaderSourceRemoteEvaluation.GetResult(Boolean enableFirewall) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.RemoteEvaluation.Evaluate(Boolean enableFirewall) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.RemoteEvaluation1.TryCompleteWithException(Exception exception) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.RemoteEvaluation.Evaluate(Boolean enableFirewall) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.EvaluationThread(Object state) at Microsoft.Mashup.Evaluator.GlobalizedEvaluatorThreadPool.<>c__DisplayClass4.b__3(Object s) at Microsoft.Mashup.Evaluator.EvaluatorThreadPool.EvaluatorThread(Object state) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass2.b__0(Object o) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass15.b__14(Object o) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass2.b__1(Object o) at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(Object obj) --- End of inner exception stack trace ---

Server stack trace:

Exception rethrown at [0]: at Microsoft.OleDb.AsyncResult1.get_Value() at Microsoft.Mashup.OleDbProvider.DataHost.BufferingMashupEvaluator.BufferingMashupEvaluation.GetBufferedReaderSource(AsyncResult1 result) at Microsoft.Mashup.OleDbProvider.DataHost.BufferingMashupEvaluator.BufferingMashupEvaluation.OnEvaluationComplete(AsyncResult`1 result)

Exception rethrown at [1]: at Microsoft.Mashup.Host.ProviderShared.MashupResource.GetStatus() at Microsoft.Mashup.Client.Excel.Fill.PollingFillDownloadWorker.b__1() at Microsoft.Mashup.Client.Excel.Fill.PollingFillDownloadWorker.InvokeWorker(Func`1 action)

Invocation Stack Trace: at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace() at Microsoft.Mashup.Client.ClientShared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace) at Microsoft.Mashup.Client.ClientShared.FeedbackErrorInfo..ctor(String message, Nullable1 errorCode, String requestId, Exception exception) at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.<>c__DisplayClass1.<HandleException>b__0() at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.SendAndMarshalExceptions(SynchronizationContext context, Action callback) at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.HandleException(Exception e) at Microsoft.Mashup.Client.Excel.Fill.FillSession.HandleDownloaderException(IWorkbook workbook, Exception e) at Microsoft.Mashup.Client.Excel.Fill.PollingInitialFillSession.FillDownloadResult(IWorkbook workbook, Boolean onTimer) at Microsoft.Mashup.Client.Excel.Fill.PollingInitialFillSession.<>c__DisplayClass4.<ResumeFill>b__0() at Microsoft.Mashup.Client.Excel.Fill.IUndoServicesExtensions.<>c__DisplayClass2.<InvokeWithConditionalDiscardedUndoScope>b__0(IUndoScope undoScope) at Microsoft.Mashup.Client.Excel.Shim.AddInUndoServices.InvokeUndoableAction(IWorkbook workbook, UndoableActionType actionType, Action1 action) at Microsoft.Mashup.Client.Excel.Fill.IUndoServicesExtensions.InvokeWithConditionalDiscardedUndoScope(IUndoServices undoServices, Boolean condition, IWorkbook workbook, UndoableActionType actionType, Action action) at Microsoft.Mashup.Client.Excel.Fill.PollingInitialFillSession.ResumeFill(Boolean onTimer) at Microsoft.Mashup.Client.Excel.PollingFillManager.b__7(IFillSession fillSession) at Microsoft.Mashup.Client.ClientShared.Model.QueriesUtilities.ForEachWithChangeScope[T](IEnumerable1 items, Func2 getQueries, Action1 action) at Microsoft.Mashup.Client.Excel.Fill.FillManager.ForEachFillSessionByWorkbook(Action1 action) at Microsoft.Mashup.Client.Excel.PollingFillManager.UpdateQueries() at Microsoft.Mashup.Client.Excel.PollingFillManager.b__6() at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action) at Microsoft.Mashup.Client.Excel.PollingFillManager.OnFillUpdateTimerTick(Object sender, EventArgs eventArgs) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

User ID: f1b43d3f-ed65-4886-993e-0d6507a0de3f

Supports Premium Content: True

Telemetry Enabled: True

DPI Scale: 100%

Formulas:

section Section1;

shared #"DataRecords Campaign_000008" = let Źródło = PostgreSQL.Database("10.100.120.18", "ContactDirect"), DataRecords_Campaign_000008 = Źródło{[Schema="DataRecords",Item="Campaign_000008"]}[Data] in DataRecords_Campaign_000008;

shared #"DataRecords Campaign_000008_ChangeLog" = let Źródło = PostgreSQL.Database("10.100.120.18", "ContactDirect"), DataRecords_Campaign_000008_ChangeLog = Źródło{[Schema="DataRecords",Item="Campaign_000008_ChangeLog"]}[Data] in DataRecords_Campaign_000008_ChangeLog;

1 Answer 1

1

The answer is: bug in npgsql 3.2.5 - after installing 3.1.9 - everything works gr8 ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.