Sublime Forum

"SQL Custom" proposal

#1

SQL is one of the last holdouts in the conversion to a stateful syntax definition. It’s also one I have to use all the time, and I suspect many of you do, too.

I believe that part of the reason it has languished here is that there are many flavors of SQL that support different features. Some flavors can’t even agree on what a comment is.

I’ve tinkered with my (non-stateful) SQL definition to the point where it might be difficult to merge the “right” bits back into the default package. I worry that even if I cleaned it up and made pull requests, people would argue about whether this or that feature exists in their flavor.

I propose that we create a new plugin that cribs some tricks from another project with similar “different flavors” support, namely Thom Smith’s JSCustom package. We would set up a stateful skeleton containing the common bits of SQL and a set of extensions injecting supplementary behaviour where desired.

  • Is this a plugin people would be interested in using?
  • Is this a project people would be interested in helping with?
  • Are related efforts already underway?
  • Is this too ambitious of a project?
  • Any other comments are also welcome.
3 Likes

#2

I love the idea — the question is whether there is truly enough syntax commonality between SQL flavors. For instance, Oracle SQL allows identifiers to be double-quoted, a highly un-orthogonal quirk. I suspect that the non-Oracle flavors are generally more well behaved.

0 Likes

#3

I do like the idea of having SQL dialects, along with the ability for them to be “enabled” as source.sql for re-used in other syntaxes. Sometimes you are working on a Go project with PostgreSQL or Python with SQLite. It is handy to have the highlighting give you some hints along the way.

I personally have never settled on the best way to achieve this.

I don’t think so. In terms of a syntax, SQL is fairly easy to deal with. I think. :wink:

Well, actually that is one of the few places where Oracle is mostly sane. https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Data_structure_definition/Delimited_identifiers :slightly_smiling_face:

0 Likes