trinodb / trino-go-client

Go client for Trino
Apache License 2.0
135 stars 63 forks source link

ParsingException for SQL Server when stored-procedure-table-function is enabled #107

Closed AK47Sonic closed 7 months ago

AK47Sonic commented 7 months ago

When I enable sqlserver.experimental.stored-procedure-table-function-enabled=true and call the stored procedure of SQL Server, the ParsingException is thrown. Seems the feature is not supported by go client. I also try the trino cli. It works fine. Could you help to enhance this feature?

db.Query( SELECT * FROM TABLE( system.procedure( query => 'EXECUTE example_schema.employee_sp' ) ); )

nineinchnick commented 7 months ago

Can you include the full stack trace? How do you quote the query? The example you included is not correctly quoted

AK47Sonic commented 7 months ago

rows, err := db.Query( select * from table( system.procedure( query => 'execute testTrino' ) ); )

trino: query failed (200 OK): "io.trino.sql.parser.ParsingException: line 9:3: mismatched input ';'. Expecting: ',', 'AS', 'CROSS', 'EXCEPT', 'FETCH', 'FULL', 'GROUP', 'HAVING', 'INNER', ....." panic: runtime error: invalid memory address or nil pointer dereference panic : runtime error: invalid memory address or nil pointer deference [signal 0xc0000005 code =0x0 addr=ox80 pc=ox6ac74e]

After I remove ; in the end of sql, it works fine now.

rows, err := db.Query( select * from table( system.procedure( query => 'execute testTrino' ) ) // remove ; )

nineinchnick commented 7 months ago

Yeah ; are not allowed in queries, as the driver cannot execute multiple statements at once.