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

sql: not authorized to use function: strftime, date etc #7602

Closed
steepdawn974 opened this issue Aug 22, 2024 · 1 comment
Closed

sql: not authorized to use function: strftime, date etc #7602

steepdawn974 opened this issue Aug 22, 2024 · 1 comment

Comments

@steepdawn974
Copy link

steepdawn974 commented Aug 22, 2024

Issue

Per lightning-sql documentation, the functions strftime, date etc should be supported, but queries fail with the error:

   "message": "query failed with not authorized to use function: strftime (Unauthorized: 31 arg1=(none) arg2=strftime dbname=(none) caller=(none))"

Steps to Reproduce

Example 1:

lightning-cli sql -k "query"="SELECT account,tag, STRFTIME('%Y-%m-%d %H:%M:%f', timestamp / 1000000000, 'unixepoch'),sum(debit_msat/1000),sum(credit_msat/1000) from bkpr_income where tag='routed'  group by 1,2,3"

{
   "code": -1,
   "message": "query failed with not authorized to use function: strftime (Unauthorized: 31 arg1=(none) arg2=strftime dbname=(none) caller=(none))"
}

Example 2:

lightning-cli sql -k "query"="SELECT account,tag,date(timestamp),sum(debit_msat/1000),sum(credit_msat/1000) from bkpr_income where tag='routed'  group by 1,2,3"

{
   "code": -1,
   "message": "query failed with not authorized to use function: date (Unauthorized: 31 arg1=(none) arg2=date dbname=(none) caller=(none))"
}

getinfo

getinfo
{
"id": "xxx",
"alias": "xxx
"color": "0362df",
"num_peers": 4,
"num_pending_channels": 1,
"num_active_channels": 3,
"num_inactive_channels": 0,
"address": [
{
"type": "torv3",
"address": "xxxxxxx.onion",
"port": 9736
}
],
"binding": [
{
"type": "ipv4",
"address": "127.0.0.1",
"port": 9736
}
],
"version": "v24.05",
"blockheight": 857896,
"network": "bitcoin",
"fees_collected_msat": ,
"lightning-dir": "/home/bitcoin/.lightning/bitcoin",
"our_features": {
"init": "08a0000a8a59a1",
"node": "88a0000a8a59a1",
"channel": "",
"invoice": "02000002024100"
}
}

@steepdawn974 steepdawn974 changed the title lightning-sql: not authorized to use function: strftime, date etc sql: not authorized to use function: strftime, date etc Aug 22, 2024
@ShahanaFarooqui
Copy link
Collaborator

Datetime functions were introduced in Core Lightning's v24.08 as part of PR #7467. However, the SQL documentation does not indicate the version in which this feature was added. To use these functions, your node has to be upgraded to v24.08.

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