vim-dadbod-ui icon indicating copy to clipboard operation
vim-dadbod-ui copied to clipboard

Query on save always canceled on Windows

Open TheLeoP opened this issue 2 years ago • 2 comments

When I open a buffer, write a query and then save it, I get the following result:

unrecognized win32 error code: 123psql: error: C:/Users/pcx/AppData/Local/Temp/nvimeAR3CD/d2a141vflldbei-query-2022-03-31 22:47:30: Invalid argument

But, if I modify the buffer, doesn't save it and use the command :%DB the query works as expected. Also, if I first save the buffer, the query fails and then I sue the command :%DB, the query also fails with the same error.

I was trying to dig into the code, but I don't really know nearly enought vimscript. Maybe the autocmd that is run on save is altering the buffer content in some way (?). I try using the dos and unix fileformat, but the result was the same.

TheLeoP avatar Apr 01 '22 04:04 TheLeoP

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.

stale[bot] avatar May 01 '22 12:05 stale[bot]

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.

stale[bot] avatar Jun 04 '22 01:06 stale[bot]

Today I finally try to solve this and I think I have found the solution. In Windows a filename can't contain colons (:) and this plugin creates it's temporary query files with a structure similar to something-2022-09-26 18:13:00. For some reason, Windows doesn't complain at Vim and let's it create the files normally, but when the argument is passed as a file name to the database executable (in my case psql.exe), it complains because of the colons in the filename. Could it be posible to replace the colons with another character? Should I open a PR doing it since it's a simple fix?

Edit: Ok, apparently the character used by this plugin isn't a color : but rather the unicode character 2236 called ratio , that's why Windows wasn't complaining. My guess now is that the psql executable on Windows doesn't like character unicodes because it complains about the path not existing even when using just vim-dadbod with the command :DB < path/to/file where path/to/file contains the ratio character.

TheLeoP avatar Sep 26 '22 23:09 TheLeoP

Thanks for investigating. I updated it to use hyphens instead of space and colon, so this should hopefully fix the issue.

kristijanhusak avatar Sep 28 '22 11:09 kristijanhusak