Version
1.10.0
What happened?
I want to query data from one to many relationships into a single row. So I use GROUP_CONCAT() to get a concatenated string of a group that I want to concatenate. My query is working fine on MySQL Workbench, but it seems to be not working from sqlc generate command.
Relevant log output
sqlc generate failed.
# package db
query.sql:19:1: function group_concat(unknown, unknown) does not exist
Database schema
-- Example queries for sqlc
CREATE TABLE authors (
id BIGINT PRIMARY KEY,
name text NOT NULL,
bio text
);
CREATE TABLE books (
id BIGINT PRIMARY KEY,
author_id BIGINT,
CONSTRAINT `fk_books_authors` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE
);
SQL queries
-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = $1 LIMIT 1;
-- name: ListAuthors :many
SELECT au.*, GROUP_CONCAT(b.id) FROM authors au, books b
ORDER BY name;
-- name: CreateAuthor :exec
INSERT INTO authors (
name, bio
) VALUES (
$1, $2
);
-- name: DeleteAuthor :exec
DELETE FROM authors
WHERE id = $1;
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "mysql",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/891e6cb09b3f8941ff763fbd30391ddc3d368c91e7335ce7b2b7efb9598b76c3
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Version
1.10.0
What happened?
I want to query data from one to many relationships into a single row. So I use GROUP_CONCAT() to get a concatenated string of a group that I want to concatenate. My query is working fine on MySQL Workbench, but it seems to be not working from
sqlc generatecommand.Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/891e6cb09b3f8941ff763fbd30391ddc3d368c91e7335ce7b2b7efb9598b76c3
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go