dolthub / dolthub/doltgresql

Prepared statements not working with Dolt table functions

Open
#807 0 comments 0 reactions 0 assignees View on GitHub
bug workbench
Dominant language
Go
Stars
2.1k
Forks
73
Avg merge
1d 10h
Merged PRs (30d)
129

Description

Query:
```
q: "SELECT * FROM dolt_diff_stat($1, $2)"
p: ["HEAD", "WORKING"],
```
Error:
`error: unsupported syntax: :v1 (errno 1105) (sqlstate HY000)`

Query with type cast:
```
q: "SELECT * FROM dolt_diff_stat($1::text, $2::text)"
p: ["HEAD", "WORKING"],
```
Error:
```
error: runtime error: invalid memory address or nil pointer dereference
at Parser.parseErrorMessage (/Users/taylor/go/src/github.com/dolthub/doltgresql/testing/postgres-client-tests/node/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/Users/taylor/go/src/github.com/dolthub/doltgresql/testing/postgres-client-tests/node/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/Users/taylor/go/src/github.com/dolthub/doltgresql/testing/postgres-client-tests/node/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket. (/Users/taylor/go/src/github.com/dolthub/doltgresql/testing/postgres-client-tests/node/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23) {
length: 85,
severity: 'ERROR',
code: 'XX000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: undefined,
line: undefined,
routine: undefined
}
```

There are a bunch of workbench tests [here](https://github.com/dolthub/doltgresql/blob/main/testing/postgres-client-tests/node/workbenchTests/diffs.js#L83) that could be updated to use prepared statements

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.