The following select statement will return no error, even though the table in question does not have a charm by the name of juju-controller.
Table contents:
uuid name description summary subordinate min_juju_version run_as_id assumes lxd_profile
31b7cf74-6773-4bf2-8bf9-ac63cb2947ac ubuntu <nil> <nil> false <nil> <nil> <nil> <nil>
Table schema:
CREATE TABLE charm_run_as_kind (
id INT PRIMARY KEY,
name TEXT NOT NULL
);
CREATE UNIQUE INDEX idx_charm_run_as_kind_name
ON charm_run_as_kind (name);
INSERT INTO charm_run_as_kind VALUES
(0, 'default'),
(1, 'root'),
(2, 'sudoer'),
(3, 'non-root');
CREATE TABLE charm (
uuid TEXT NOT NULL PRIMARY KEY,
name TEXT,
description TEXT,
summary TEXT,
subordinate BOOLEAN DEFAULT FALSE,
min_juju_version TEXT,
run_as_id INT,
assumes TEXT,
lxd_profile TEXT,
CONSTRAINT fk_charm_run_as_kind_charm
FOREIGN KEY (run_as_id)
REFERENCES charm_run_as_kind (id)
);
Query that should return sql.ErrNoRows, instead returns nil.
SELECT 1 FROM charm WHERE name = 'juju-controller' AND uuid = $charmID.uuid;
The following select statement will return no error, even though the table in question does not have a charm by the name of
juju-controller.Table contents:
Table schema:
Query that should return
sql.ErrNoRows, instead returns nil.