Closed RenatoMartins-tomtom closed 1 year ago
Hi @RenatoMartins-tomtom , thanks for reporting this issue and my apologies for the delay in response. I've notified our driver team so this can be investigated.
This is reproducible with just having a table with a timestamptz column and adding one value to such a column. Doing a selection using e.g. powershell and a DSN for the ODBC driver, will result in this error (although one might have to try two times to get the full error).
E.g., the set up:
create table tz (tz TIMESTAMPTZ); insert into tz values ('2020-07-02 18:00:00.000 +0200');
And then doing "select * from tz;
via the ODBC driver, for instance using powershell (as described here).
@mkollind I will give this a priority. I'll try to reproduce the issue and provide a fix. Appologies again for the delay and thanks for adding new information.
An unhandled situation detected in convertSQLDataToCData() during SQL_C_WCHAR->SQL_VARCHAR conversion, when getRsVal() had initially returned FALSE. That is where rsVal.pcVal is used while the address is invalid(not NULL). I drafted a fix that can be pushed after regresion tests.
@mkollind is this the result you were expecting:
cursor.execute("create table tz (tz TIMESTAMPTZ);")
cursor.execute("insert into tz values ('2020-07-02 18:00:00.000 +0200');")
cursor.execute("select * from tz;")
val = cursor.fetchall()[0][0]
print(f'value is {val}.')
Result: 2020-07-02 16:00:00+00
Yes, that is what I expected.
@RenatoMartins-tomtom and @mkollind could you plz confirm this is working in with the latest release v2.0.0.7? Thanks
I cannot reproduce this for the latest release (2.0.0.7).
@mkollind Thanks
resolved
Driver version
2.00.00.01
Redshift version
Redshift 8.0.2 PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.44126
Client Operating System
Win 10 21H2 (19044.2251)
Table schema
Relevant column is of type timestamptz
Problem description
Expected behaviour: return the column properly in a select statement
Actual behaviour: ODBC error
Error message/stack trace: Unexpected error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Details: Microsoft.Mashup.Evaluator.Interface.ErrorException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.Mashup.Engine1.Library.Odbc.Interop.OdbcStatementHandle.GetData(Int32 index, SQL_C sqlctype, IntPtr buffer, Int64 bufferLength, Int64& cbActual) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcPageReader.OdbcPage.GetData(SQL_C cType, Int32 rowIndex, Int32 columnIndex, Int64 pos) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcPageReader.OdbcPage.LoadCellData(OdbcPageReaderColumnInfo columnInfo, Column column, Int32 rowIndex, Int32 rowSetIndex, Int32 columnIndex) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcPageReader.OdbcPage.SyncColumnsPage(Byte* boundColumnsDataPtr) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcPageReader.OdbcPage.Read(OdbcStatementHandle statement, RowRange rowRange) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcPageReader.Read(OdbcPage page) at Microsoft.Mashup.Common.IPageReaderExtensions.NotifyingPageReader.Read(IPage page) at Microsoft.Mashup.Engine.Interface.Tracing.TracingPageReader.Read(IPage page) at Microsoft.Mashup.Common.IPageReaderExtensions.NotifyingPageReader.Read(IPage page) at Microsoft.Mashup.Common.IPageReaderExtensions.NotifyingPageReader.Read(IPage page) at Microsoft.Mashup.Engine1.Library.Odbc.OdbcDataSource.ExceptionHandlingPageReader.<>cDisplayClass2_0.b0()
at Microsoft.Mashup.Engine1.Library.Common.DbExceptionHandler.<>cDisplayClass11_0.b 0()
at Microsoft.Mashup.Engine1.Library.Common.DbExceptionHandler.RunWithRetryGuard[T](Int32 maxRetryAttempts, Funcb0()
at Microsoft.Mashup.Engine1.Library.Common.DbData.CachingDbDataReader.TraceException(Funcb 0()
at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(String entryName, IEngineHost engineHost, IMessageChannel channel, Action action)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Evaluator.EvaluationHost.<>cDisplayClass17_0.b1()
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(String entryName, IEngineHost engineHost, IMessageChannel channel, Action action)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>cDisplayClass12_1`1.b 0()
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, Action
1 action) at Microsoft.Mashup.Engine1.Library.Common.DbExceptionHandler.Invoke[T](Int32 maxRetry, Func
1 action) at Microsoft.Mashup.Engine1.Library.Common.DbExceptionHandler.InvokeWithoutRetry(Action action) at Microsoft.Mashup.Engine1.Library.Common.ProgressPageReader.Read(IPage page) at Microsoft.OleDb.Serialization.PageReaderDataReader.Read() at Microsoft.Mashup.Engine1.Library.Common.DbData.CachingDbDataReader.<>cDisplayClass47_0.1 tracer, Action action) at Microsoft.Mashup.Engine1.Library.Common.DbData.CachingDbDataReader.WrappedRead() at Microsoft.Mashup.Engine1.Library.Common.DbData.CachingDbDataReader.Read() at Microsoft.Mashup.Engine1.Runtime.SkipTakeEnumerator
1.MoveNext() at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.ValuePreviewValueSource.TableValuePreviewValueSource.SerializeRows(Int32 count) at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.ValuePreviewValueSource.TableValuePreviewValueSource.get_SmallValue() at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_SmallValue() at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.<>cDisplayClass0_0.1 action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetPreviewValueSource(IMessageChannel channel, BeginGetPreviewValueSourceMessage 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.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__DisplayClass9_0.<CreateAction>b__0(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.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.RemotePreviewValueSource.PreviewValueSource.WaitFor(Func
1 condition, Boolean disposing) at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.get_SmallValue() at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_SmallValue() at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.SetPreviewValue(EvaluationResult21 result, Func
1 getStaleSince, Func`1 getSampled)ODBC trace logs
Not sure how to collect these
Reproduction code
Don't have it, using it as a query in PowerBI.