Closed
Description
Version
1.18.0
What happened?
When attempting to INSERT
with multiple VALUES
, we receive an error.
Relevant log output
# package db
queries.sql:1:1: INSERT has more expressions than target columns
exit status 1
internal/advisory/db/generate.go:3: running "go": exit status 1
Database schema
CREATE TABLE IF NOT EXISTS advisories (
package_pattern TEXT NOT NULL,
package_manager TEXT NOT NULL,
version TEXT,
-- lexicographically match
version_match_strategy TEXT
CHECK (
version_match_strategy IN (
"ANY",
"EQUALS",
"LESS_THAN",
"LESS_EQUAL",
"GREATER_THAN",
"GREATER_EQUAL"
)
),
advisory_type TEXT NOT NULL
CHECK (
advisory_type IN (
"DEPRECATED",
"UNMAINTAINED",
"SECURITY",
"OTHER"
)
),
description TEXT NOT NULL,
UNIQUE (package_pattern, version, version_match_strategy, advisory_type) ON CONFLICT REPLACE
);
SQL queries
-- name: InsertKnownAdvisories
INSERT INTO advisories (
package_pattern,
package_manager,
version,
version_match_strategy,
advisory_type,
description
) VALUES
(
'github.com/pkg/errors',
'gomod',
NULL,
NULL,
'DEPRECATED',
'pkg/errors is no longer necessary, as functionality exists in the Go standard library, or in better packages'
),
(
'github.com/gorilla/*',
'gomod',
NULL,
NULL,
'UNMAINTAINED',
'the Gorilla Toolkit was archived in 2022, and is unmaintained since'
)
;
Configuration
version: 2
sql:
- engine: "sqlite"
schema: "schema.sql"
queries: "queries.sql"
gen:
go:
package: db
out: .
Playground URL
No response
What operating system are you using?
Linux, macOS
What database engines are you using?
SQLite
What type of code are you generating?
Go