Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to insert NULL for varbinary in SQL Server #4795

Closed
ebyhr opened this issue Aug 12, 2020 · 2 comments · Fixed by #4846
Closed

Failed to insert NULL for varbinary in SQL Server #4795

ebyhr opened this issue Aug 12, 2020 · 2 comments · Fixed by #4846
Assignees
Labels
bug Something isn't working

Comments

@ebyhr
Copy link
Member

ebyhr commented Aug 12, 2020

Steps to reproduce:

# SQL Server
1> create table dbo.test (c1 int, c2 varbinary(max), c3 image);
2> go

# Presto
presto> insert into sqlserver.dbo.test values (1, X'65683F', X'65683F');
INSERT: 1 row

presto> insert into sqlserver.dbo.test values (1, null, null);

Query 20200812_140614_00007_yrg9g failed: Failed to insert data: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
io.prestosql.spi.PrestoException: Failed to insert data: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
	at io.prestosql.plugin.jdbc.JdbcPageSink.finish(JdbcPageSink.java:168)
	at io.prestosql.operator.TableWriterOperator.finish(TableWriterOperator.java:203)
	at io.prestosql.operator.Driver.processInternal(Driver.java:397)
	at io.prestosql.operator.Driver.lambda$processFor$8(Driver.java:283)
	at io.prestosql.operator.Driver.tryWithLock(Driver.java:675)
	at io.prestosql.operator.Driver.processFor(Driver.java:276)
	at io.prestosql.execution.SqlTaskExecution$DriverSplitRunner.processFor(SqlTaskExecution.java:1076)
	at io.prestosql.execution.executor.PrioritizedSplitRunner.process(PrioritizedSplitRunner.java:163)
	at io.prestosql.execution.executor.TaskExecutor$TaskRunner.run(TaskExecutor.java:484)
	at io.prestosql.$gen.Presto_testversion____20200812_135122_1.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.sql.BatchUpdateException: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2065)
	at io.prestosql.plugin.jdbc.JdbcPageSink.finish(JdbcPageSink.java:160)
	... 12 more
@walter-weinmann
Copy link

Is there any progress on this issue?

@findepi
Copy link
Member

findepi commented Sep 3, 2020

@walter-weinmann yes, see #4846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants