sqlup-mode.el icon indicating copy to clipboard operation
sqlup-mode.el copied to clipboard

keywords in quotes

Open spluque opened this issue 7 years ago • 3 comments

I noticed that keywords get capitalized when in double quotes, e.g. to escape keywords in column names. It would be nice to have an option or mechanism to avoid capitalization of double-quoted keywords for these cases.

I'm using the latest melpa version (20170610.837) on Emacs 25.2.2.

spluque avatar Dec 04 '17 15:12 spluque

Hi, and thank you for the feature request! Yeah, I think that's a good idea. I'm not sure I can provide you with an ETA for the code though. As always, pull requests welcome (and if you have never done work on emacs-lisp or in code and you want to get started, let me know and I'll do my best to help you get going).

Trevoke avatar Dec 07 '17 14:12 Trevoke

The cause of this seems to be that by default sql-mode doesn't think double-quotes count as a quoting character in sql.

You tell it that they are quotes by doing: (modify-syntax-entry ?" "\"" sql-mode-syntax-table). Then sqlup seems to work as expected. This might have other consequences that I haven't thought of, but it should be safe.

davidshepherd7 avatar Dec 22 '17 16:12 davidshepherd7

While @davidshepherd7 's fix does work, it's not quite ideal as it causes quoted identifiers to be highlighted as string literals. Given how easy it is to accidentally use the wrong quotes in SQL (especially coming from languages where it doesn't matter), it would be better if we didn't have to lose that distinction.

alandmoore avatar Jan 14 '20 20:01 alandmoore