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

Issues with parametrized queries Windows/DuckDB #186

Open
an0nym05 opened this issue Mar 30, 2023 · 2 comments
Open

Issues with parametrized queries Windows/DuckDB #186

an0nym05 opened this issue Mar 30, 2023 · 2 comments

Comments

@an0nym05
Copy link

When I execute this query directly (replace placeholder with variables) there's no issue:

13:07:03 DBG 22 duckdb_storage.go:19 > query="CREATE TABLE \"Source\" AS \n\t\t\t\tSELECT * FROM read_csv_auto('examples/data/airlines.dat', HEADER=true, SEP=\",\")" composed ImportCSV query

But when I run it parametrized (and pass false and , as arguments):

13:00:32 DBG 22 duckdb_storage.go:19 > query="CREATE TABLE \"Source\" AS \n\t\t\t\tSELECT * FROM read_csv_auto('examples/data/airlines.dat', HEADER=?, SEP=?)" composed ImportCSV query

I receive the following panic:

Exception 0xe06d7363 0x19930520 0xc0d31ff150 0x7ffd1f8cfe7c
PC=0x7ffd1f8cfe7c

runtime.cgocall(0xd588c0, 0xc0001002c0)
        C:/Program Files/Go/src/runtime/cgocall.go:157 +0x4a fp=0xc000391560 sp=0xc000391528 pc=0xcf4d2a
syscall.SyscallN(0xc000008168?, {0xc0003915f8?, 0x10?, 0x0?})
        C:/Program Files/Go/src/runtime/syscall_windows.go:557 +0x109 fp=0xc0003915d8 sp=0xc000391560 pc=0xd53ac9
syscall.Syscall6(0xc000192510?, 0x12e74a0?, 0xc0003916ee?, 0x1df57c40278?, 0x1df32150a28?, 0x60?, 0xc000100000?, 0xc000342120?)
        C:/Program Files/Go/src/runtime/syscall_windows.go:501 +0x50 fp=0xc000391638 sp=0xc0003915d8 pc=0xd53850
github.com/alexbrainman/odbc/api.SQLDescribeParam(0xc000384380?, 0x1, 0xc000391718?, 0xf5c825?, 0xc000192750?, 0xc000391718?)
        D:/Projects/cascades-app/vendor/github.com/alexbrainman/odbc/api/zapi_windows.go:96 +0x90 fp=0xc0003916b8 sp=0xc000391638 pc=0xf5bef0
github.com/alexbrainman/odbc.ExtractParameters(0xc00039e1c0?)
        D:/Projects/cascades-app/vendor/github.com/alexbrainman/odbc/param.go:186 +0x116 fp=0xc000391728 sp=0xc0003916b8 pc=0xf61f56
github.com/alexbrainman/odbc.(*Conn).PrepareODBCStmt(0xc000354018, {0xc00037c070, 0x68})
        D:/Projects/cascades-app/vendor/github.com/alexbrainman/odbc/odbcstmt.go:48 +0x139 fp=0xc0003918b0 sp=0xc000391728 pc=0xf60719
github.com/alexbrainman/odbc.(*Conn).Prepare(0xc000354018, {0xc00037c070, 0x68})
        D:/Projects/cascades-app/vendor/github.com/alexbrainman/odbc/stmt.go:26 +0x3b fp=0xc0003918e0 sp=0xc0003918b0 pc=0xf626bb
database/sql.ctxDriverPrepare({0x13f9a48, 0xc000028110}, {0x13f94c0, 0xc000354018}, {0xc00037c070, 0x68})
        C:/Program Files/Go/src/database/sql/ctxutil.go:17 +0x71 fp=0xc000391938 sp=0xc0003918e0 pc=0xf3b571
database/sql.(*DB).execDC.func3()
        C:/Program Files/Go/src/database/sql/sql.go:1687 +0x4b fp=0xc000391988 sp=0xc000391938 pc=0xf42b0b
database/sql.withLock({0x13f7ff8, 0xc00036a000}, 0xc000391af8)
        C:/Program Files/Go/src/database/sql/sql.go:3405 +0x8c fp=0xc0003919c8 sp=0xc000391988 pc=0xf4ba6c
database/sql.(*DB).execDC(0xd73301?, {0x13f9a48, 0xc000028110}, 0xc00036a000, 0xc000391c38?, {0xc00037c070, 0x68}, {0xc000391df0, 0x2, 0x2})
        C:/Program Files/Go/src/database/sql/sql.go:1686 +0x354 fp=0xc000391bd8 sp=0xc0003919c8 pc=0xf42734
database/sql.(*DB).exec(0x13f6c00?, {0x13f9a48, 0xc000028110}, {0xc00037c070, 0x68}, {0xc000391df0, 0x2, 0x2}, 0x90?)
        C:/Program Files/Go/src/database/sql/sql.go:1655 +0xe8 fp=0xc000391c50 sp=0xc000391bd8 pc=0xf42368
database/sql.(*DB).ExecContext.func1(0x40?)
        C:/Program Files/Go/src/database/sql/sql.go:1634 +0x55 fp=0xc000391cb8 sp=0xc000391c50 pc=0xf42155
database/sql.(*DB).retry(0xcfdf28?, 0xc000391d30)
        C:/Program Files/Go/src/database/sql/sql.go:1538 +0x47 fp=0xc000391d00 sp=0xc000391cb8 pc=0xf416c7
database/sql.(*DB).ExecContext(0x1736d00?, {0x13f9a48?, 0xc000028110?}, {0xc00037c070?, 0x68?}, {0xc000391df0?, 0xc000391e30?, 0xe7d316?})
        C:/Program Files/Go/src/database/sql/sql.go:1633 +0xcc fp=0xc000391d98 sp=0xc000391d00 pc=0xf4206c
database/sql.(*DB).Exec(...)
        C:/Program Files/Go/src/database/sql/sql.go:1647
github.com/McK-Internal/cascades-app/runtime/storage.(*DuckDBStorage).ImportCSV(0xc000362010, {0xc00019839c?, 0xc?}, {0xc0001983b0, 0x1a}, 0xc0003406c0)
@alexbrainman
Copy link
Owner

Exception 0xe06d7363 0x19930520 0xc0d31ff150 0x7ffd1f8cfe7c

I suspect that this error comes from your database driver. According to

https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273

https://stackoverflow.com/questions/9095898/decoding-the-parameters-of-a-thrown-c-exception-0xe06d7363

this exception is thrown by code compiled by Visual C++. So it must be a database driver DLL that is loaded by ODBC API calls.

You should I ask help from people who built the DLL. I cannot help you.

Alex

@an0nym05
Copy link
Author

an0nym05 commented Apr 2, 2023

Thank you for investigation, @alexbrainman! I will try my luck with DuckDB developers (crossed referenced issue already).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants