Skip to content
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

Error in DESCRIBE PLAN SELECT COUNT(*) FROM table on running server #8882

Open
nicktobey opened this issue Feb 23, 2025 · 3 comments
Open

Error in DESCRIBE PLAN SELECT COUNT(*) FROM table on running server #8882

nicktobey opened this issue Feb 23, 2025 · 3 comments
Assignees
Labels
bug Something isn't working customer issue sql server Issues related to the built in SQL server sql Issue with SQL

Comments

@nicktobey
Copy link
Contributor

Connecting to a running server and running a query of the form DESCRIBE PLAN SELECT COUNT(*) FROM table results in an error:

Error 1105 (HY000): result max1Row iterator returned more than one row

This only happens when connecting to a server, and not when running dolt sql locally.

This seems to be happening because the presence of the COUNT expression causes the analyzer to set the sql.QFlagMax1Row flag, but the DESCRIBE statement produces a row for each line in the plan.

@macneale4
Copy link
Contributor

macneale4 commented Mar 3, 2025

This is a more general bug:

You can recreate with:

CREATE TABLE mytable1 (
  id INT AUTO_INCREMENT PRIMARY KEY,
  str VARCHAR(255),
  num INT
);
CREATE TABLE mytable2 (
  id INT AUTO_INCREMENT PRIMARY KEY,
  str VARCHAR(255),
  num INT
);
INSERT INTO mytable1 (str, num) VALUES
('abc', 123);
INSERT INTO mytable2 (str, num) VALUES
('def', 456);
CALL dolt_add('.');
CALL dolt_commit('-m', 'my commit');
SELECT *
FROM dolt_diff
WHERE commit_hash = '<commit_hash>'
AND table_name LIKE 'mytable%';

(commit ID is the commit created in first step).

Note that this only happens when running in a sql-server - won't happen if you run dolt sql on your datadir.

@timsehn timsehn added bug Something isn't working sql Issue with SQL sql server Issues related to the built in SQL server customer issue labels Mar 3, 2025
@timsehn
Copy link
Contributor

timsehn commented Mar 3, 2025

This effects a user. It will be fixed today.

@nicktobey
Copy link
Contributor Author

The issues, while related, were different. In both cases the QFlagMax1Row flag was improperly set, but for different reasons.

The bug that @macneale4 reported was fixed with dolthub/go-mysql-server#2868.

The original query described in this issue is still not working, but isn't affecting users. I'll keep this issue open to track the original bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer issue sql server Issues related to the built in SQL server sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

3 participants