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

Suppress auto-uppercase for column and table names which are also keywords #494

Closed
lbuchs opened this Issue Jan 24, 2019 · 8 comments

Comments

Projects
None yet
4 participants
@lbuchs
Copy link

lbuchs commented Jan 24, 2019

Steps to reproduce this issue

  1. Make a table with a column called "Name"
  2. Write a query: Write tablename. then select the column "Name" from autocomplete list
  3. Heidi writes now tablename.Name.
  4. If you add a Space it gets converted to tablename.NAME

Current behavior

HeidiSQL converts column name to uppercase.

Expected behavior

autocomplete should write tablename.`Name` . It works for many keywords like start, end, type, select but not for Name.

Possible solution

autocomplete should add grave accent (`) to the all column names if it is a keyword which gets converted to uppercase.

Environment

  • HeidiSQL version: Version 10.0.0.5460 (64 Bit)
  • Database system and version: 10.2.18-MariaDB
  • Operating system: Win 10

@ansgarbecker ansgarbecker added this to the v10.2 milestone Jan 27, 2019

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

ansgarbecker commented Jan 27, 2019

Do you think it's sufficient to quote that "name" string to solve this? Are there more strings identified as keyword?

@lbuchs

This comment has been minimized.

Copy link
Author

lbuchs commented Jan 28, 2019

There is a list of all keywords: https://dev.mysql.com/doc/refman/8.0/en/keywords.html - would be nice if all this keywords gets quoted, independent if its written in upper- or lowercase.

Here is the keyword list as text: mysql8_keywords.txt

@ansgarbecker ansgarbecker changed the title autocomplete should add grave accent ( ` ) if necessary Suppress auto-uppercase for column and table names which are also keywords Jan 28, 2019

@fifonik

This comment has been minimized.

Copy link

fifonik commented Jan 30, 2019

I do not like the idea to have these backquotes everywhere without reason.
I believe, that if column was auto-completed, the auto upper-scaling must be skipped for this.

I have quite a few columns named Data, Time, Name etc and I'm "forcing" to type queries with the backquote to prevent the columns upperscaling

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

ansgarbecker commented Jan 31, 2019

You can of course disable auto-uppercasing:
grafik

Ok, that's not really a solution. But it seems quite tricky up to impossible to reliably remember identifiers which were auto-completed. Perhaps words preceded by a dot should not be uppercased.

@fifonik

This comment has been minimized.

Copy link

fifonik commented Jan 31, 2019

I do like auto uperscaling for words like 'select', 'from' and even 'date'!
However, when I'm typing select * from table where table.d<space for auto-complete> I'd like the auto-completed 'Date' would not auto-upercased. If I understand correctly, the auto-upercase only do it for last edited word, not for whole previously entered string. At least I can go back to the auto-upercased 'DATE', change it to 'Date' and then use arrows or mouse to skip another auto upercasing.

@lbuchs

This comment has been minimized.

Copy link
Author

lbuchs commented Jan 31, 2019

Maybe you can just auto uppercase if the reserved word is "stand-alone" (just white space, line break or no char before the reserved word).

So if you typing Select<space-for-uppercase> it get's converted to uppercase, if you write xxx.Select<space-for-uppercase> it get's not converted because there is a point before the reserved word.

-- EDIT:
maybe just look if there is a point (.) before the reserved word, if yes, don't convert. If you look for white space, things like (Date<space-for-uppercase> are not converted anymore.

@Val870

This comment has been minimized.

Copy link

Val870 commented Mar 8, 2019

Just to be sure as it has not been mentioned but when you say "don't convert", you mean not uppercasing it and quoting it, right ?
Because if it's not quoted, it will be colored as any keyword usually is. And so, a column name could be mistaken for a keyword at first glance.

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

ansgarbecker commented Mar 9, 2019

Should be fixed in the next build. I am now checking the character left besides the token in question, and don't uppercase it if it's a dot.

Also, backspace does not trigger uppercasing now, e.g. when you have a table named countries, and you backspace the right chars so you have count only - this was immediately uppercased up to now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.