-
Notifications
You must be signed in to change notification settings - Fork 867
sqlite: json_each
's value
parameter isn't supported
#1830
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
Comments
This also appears to be true when the following query is used: -- name: RetrievePublicPostsForCategory :many
select
category.value,
slug,
raw,
json_extract(posts.raw, '$.properties.published[0]') published,
json_extract(posts.raw, '$.properties.visibility[0]') visibility
from
posts,
json_each(json_extract(posts.raw, '$.properties.category')) category
WHERE visibility == 'public'
AND category.value = ?
ORDER BY published DESC
LIMIT 50; But I get:
|
It looks like we can reference Schema: CREATE TABLE IF NOT EXISTS renovate (
organisation TEXT NOT NULL,
repo TEXT NOT NULL,
package_name TEXT NOT NULL,
version TEXT NOT NULL,
locked_version TEXT,
package_manager TEXT NOT NULL,
package_file_path TEXT NOT NULL,
datasource TEXT NOT NULL,
-- dep_types is a JSON array
dep_types TEXT,
UNIQUE (organisation, repo, package_file_path, package_name, package_manager, dep_types) ON CONFLICT REPLACE
); Query: select
count(*),
package_name,
dt.value as dep_type
from
renovate,
json_each(renovate.dep_types) as dt
where package_name like 'github.com/gorilla/%'
and datasource = 'go'
group by package_name order by count(*) DESC; |
@kyleconroy looks like this may also affect Postgres. With the following diff: diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql
index 94da2699..b68d262b 100644
--- a/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql
+++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql
@@ -8,9 +8,10 @@ CREATE TABLE transactions (
/* name: GetTransaction :many */
SELECT
json_extract(transactions.data, '$.transaction.signatures[0]'),
- json_group_array(instructions.value)
+ json_group_array(instructions.value),
+ instructions.value
FROM
transactions, Results in:
|
Ping. :) Still reproduces with sqlc 1.20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
1.15.0 - 1.23.0
What happened?
The noted query produces an error:
When running
go generate
, with the following build tag://go:generate go run github.com/kyleconroy/sqlc/cmd/sqlc generate
When running this in an
sqlite3 v3.38.5
shell, this produces:For the following entry in the database:
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
No response
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: