I can't see what I am doing wrong, but I am not an SQL expert. So, I am
doing something wrong or is there a problem with Derby 10.5.1.1?
Looks like a bug in Derby to me, unfortunately. It fails for me on the
current Derby trunk, with this SQL submitted to the ij tool:
drop table types;
drop table methods;
drop table methodParameters;
CREATE TABLE types (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
name VARCHAR(128) NOT NULL UNIQUE,
shortName VARCHAR(64) NOT NULL
);
create table methods (id int primary key generated always as identity);
CREATE TABLE methodParameters (
method INT REFERENCES methods (id),
position INT,
parameter INT REFERENCES types (id)
);
prepare p as 'SELECT method, COUNT(method) FROM methodParameters INNER JOIN types ON parameter = id WHERE name IN (?) GROUP BY
method HAVING COUNT(method) >= ?';
If you could please file an issue in JIRA, that would be great.
http://db.apache.org/derby/DerbyBugGuidelines.html
I think this issue is quite possibly related to the work we did for
DERBY-2526, so perhaps you could mention that as a possibility in the
problem report.
thanks,
bryan