Cannot use SQL method with WHERE something > number
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the SQLRequest type and the lightning.Request call shown in the issue, then reproduce the failure using the linked test repository. Trace JSON encoding around Request and compare it with the working shell JSON-RPC request; done means a query containing WHERE expiry > 1 succeeds without the unrecognized-token error.
Written by the indexing model from the issue text.
Description
This query works using lighting-cli:
$ lightning-cli sql -k query="SELECT * FROM htlcs WHERE expiry > 1;"
{
"rows": [
[
2381,
It also works using JSON-RPC in shell:
$ echo '{"method": "sql", "params": {"query": "SELECT * FROM htlcs WHERE expiry > 1;"}, "id": 1, "jsonrpc": "2.0"}' | nc -U ${PWD}/.lightning/testnet/lightning-rpc
{"jsonrpc":"2.0","id":1,"result":{"rows":[[2456,"2821409x111x0",0,2821429,1000000,"in","c95ad151010e9cc14238bce909e6e8545258fc07d0e00c98a4b5ff90ac049e61","SENT_REMOVE_ACK_REVOCATION"],[2457,"2821
But it DOES NOT work with glightning:
type SQLRequest struct {
Query string `json:"query"`
}
func (r SQLRequest) Name() string {
return "sql"
}
....
// this fails with error
// -1:query failed with unrecognized token: "\"
err = lightning.Request(&SQLRequest{
Query: "SELECT * FROM htlcs WHERE expiry > 1;",
}, &response)
glightning is apparently escaping > with \, but I cannot find where.
here is the test repo.
Output:
2024/09/05 16:44:11 Rows: 75
2024/09/05 16:44:11 Rows: 0
2024/09/05 16:44:11 SQLRequest: -1:query failed with unrecognized token: "\"
- Dominant language
- Go
- Stars
- 11
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ElementsProject/glightning
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ElementsProject/glightning#15 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in ElementsProject/glightning
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bazel-contrib/rules_go#4726 · 1 comment ·
-
area/auto-scaling area/monitoring area/ops-productivity kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Type/Improvement
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
OpenNSW/nsw-srilanka#522 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100