kristijanhusak / vim-dadbod-ui

Simple UI for https://github.com/tpope/vim-dadbod
MIT License
1.54k stars 94 forks source link

Querying for timestamped fields doesn't work. #142

Open morgan-greywolf opened 2 years ago

morgan-greywolf commented 2 years ago

Consider the following table:

CREATE TABLE Book
id int unsigned NOT NULL AUTO_INCREMENT,
title varchar(255) DEFAULT NULL,
author varchar(255) DEFAULT NULL,
when_added timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

Now do:

SELECT * FROM Book where when_added >= '2022-09-30 00:00:00';

The results in dbout will be:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/home/foo/bar/' at line 1

rather than the expected result.

kristijanhusak commented 2 years ago

Does it work when you run it through command?

:DB SELECT * FROM Book where when_added >= '2022-09-30 00:00:00';

I'm not sure why the syntax is not right, but this is most likely not issue with this plugin.

morgan-greywolf commented 2 years ago

The query does work when you run it through a direct :DB command as shown, but does not work with DBUI_ExecuteQuery.

morgan-greywolf commented 2 years ago

In case it's not obvious, my database is MySQL 8.x.

kristijanhusak commented 2 years ago

Does it work when you run a query without a time part?

SELECT * FROM Book where when_added >= '2022-09-30';
morgan-greywolf commented 2 years ago

Works for both :DB and DBUI_ExecuteQuery

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.