I've been playing around with various things that didn't work as I expected in SQL Prompt 2 to see what has changed in 3. The new version is definitely a step up, and would be close to perfect, with a few tweaks:
  • When showing tables/views, the candidate list should (optionally) contain only tables with foreign keys between them, except after FROM and CROSS JOIN.
    • It would make sense for this to be the behavior if the "Include matching column names" and "Include matching data types" options are not selected.
    • Alternatively, tables with foreign keys should be displayed together at the top of the list, with unrelated tables below.
  • Individual key fields in a compound foreign key should not be listed separately. For example, with these tables:
    create table A(a_id int not null constraint PK_A primary key)
    create table B(
    	a_id int not null foreign key references A(a_id), 
    	b_id int not null, 
    	constraint PK_B primary key (a_id, b_id)
    )
    create table C(
    	a_id int not null,
    	b_id int not null,
    	c_id int not null,
    	constraint PK_C primary key (a_id, b_id, c_id),
    	constraint FK_C_B foreign key (a_id, b_id) references B(a_id, b_id)
    )
    
    typing
    select * from B b join C c on
    
    results in three options based on the foreign key:
    b.a_id = c.a_id
    b.a_id = c.a_id and b.b_id = c.b_id
    b.b_id = c.b_id
    
    Only the middle one (b.a_id = c.a_id and b.b_id = c.b_id) should be displayed.
  • joins on foreign keys are "backwards"; if B refers to A as above, joins should be in the form 'b.a_id = a.a_id'.
    • This could be an option
    • Better still, SQL Prompt should change the autocomplete candidate to match what you type after ' on '. For example, if you type
      select * from A a join B b on b.
      
      then the completion list's first option should be
      b.a_id = a.a_id
      
      but if you type
      select * from A a join B b on a.
      
      then the candidate list's first option should be
      a.a_id = b.a_id
      
  • the candidate list should not be shown after a table name has just been typed, i.e., when I am typing a table alias.
  • the candidate list should continue to include joins on foreign keys after I have typed a table alias. Right now, if I type in
    select * from A a join B b on a
    
    the candidate list correctly contains
    a.a_id = b.a_id
    
    However, if I continue typing that option, starting with a ".", the join candidate is removed from the list and the list only contains candidate columns.
  • Using black as the window background color in the Windows color scheme (like the High Contrast Black color scheme) makes quite a bit of text illegible (when the text color is black, on a black background) or very difficult to read (blue text on a black background.) This affects both the completion list and snippets.
bis
0

Comments

2 comments

  • Tilman
    Hi,

    Thanks for the feedback.
    When showing tables/views, the candidate list should (optionally) contain only tables with foreign keys between them, except after FROM and CROSS JOIN.


    * It would make sense for this to be the behavior if the "Include matching column names" and "Include matching data types" options are not selected.
    * Alternatively, tables with foreign keys should be displayed together at the top of the list, with unrelated tables below.
    I've added a suggestion to our list.
    Individual key fields in a compound foreign key should not be listed separately. For example, with these tables:
    Code:
    create table A(a_id int not null constraint PK_A primary key)
    create table B(
    a_id int not null foreign key references A(a_id),
    b_id int not null,
    constraint PK_B primary key (a_id, b_id)
    )
    create table C(
    a_id int not null,
    b_id int not null,
    c_id int not null,
    constraint PK_C primary key (a_id, b_id, c_id),
    constraint FK_C_B foreign key (a_id, b_id) references B(a_id, b_id)
    )

    typing
    Code:
    select * from B b join C c on

    results in three options based on the foreign key:
    Code:
    b.a_id = c.a_id
    b.a_id = c.a_id and b.b_id = c.b_id
    b.b_id = c.b_id

    Only the middle one (b.a_id = c.a_id and b.b_id = c.b_id) should be displayed.
    Added to the list.
    joins on foreign keys are "backwards"; if B refers to A as above, joins should be in the form 'b.a_id = a.a_id'.


    This could be an option
    I suppose we could make it an option.
    Better still, SQL Prompt should change the autocomplete candidate to match what you type after ' on '. For example, if you type
    Code:
    select * from A a join B b on b.
    then the completion list's first option should be
    Code:
    b.a_id = a.a_id
    but if you type
    Code:
    select * from A a join B b on a.
    then the candidate list's first option should be
    Code:
    a.a_id = b.a_id
    Don't push your luck ;)
    the candidate list should not be shown after a table name has just been typed, i.e., when I am typing a table alias.
    Added to the list.
    he candidate list should continue to include joins on foreign keys after I have typed a table alias. Right now, if I type in
    Code:
    select * from A a join B b on a
    the candidate list correctly contains
    Code:
    a.a_id = b.a_id
    However, if I continue typing that option, starting with a ".", the join candidate is removed from the list and the list only contains candidate columns.
    This is by design. The problem is that '.' is a special character that either inserts or closes the candidate list, since on other ocasions you do only want the columns. '.' does not filter the candidate list, so you'll never get what's before the dot on the CL (also a problem with dots in escaped identifiers).
    Using black as the window background color in the Windows color scheme (like the High Contrast Black color scheme) makes quite a bit of text illegible (when the text color is black, on a black background) or very difficult to read (blue text on a black background.) This affects both the completion list and snippets.
    This is a known issue. Only out of interest, do you need high contrast or is it a choice?

    Regards,

    Tilman
    Tilman
    0
  • bis
    Here's a quick history of how computers have been punching me in the eyes (or not) with their color schemes:
    • The Commodore 64, which had light blue text on a darker blue background - very easy on the eyes
    • The Apple II, which had white text on a black background - also very nice to look at. (except for the weird color fringing around the edges of characters due to Apple's before-its-time sub-pixel rendering.)
    • MS-DOS. Light gray on black. So soothing.
    • Turbo Pascal, WordPerfect, MS Word, and many others for DOS: white or yellow text on a blue background. Very easy to read. (And Turbo Pascal 7 had syntax highlighting!)
    • Windows 3.x, 9x. Black text on a white background by default, which portends much. But at least it's easy to change to white-on-black.
    • AutoCAD: white lines on a black background by default.
    • Emacs: Has 'light' and 'dark' settings as well as complete customizability. I use 'dark'.
    • Visual Studio and Query Analyzer: follows Windows' color scheme, and allows all of the syntax highlighting colors to be customized.
    • Red Gate SQL Prompt: sometimes follows Windows' color scheme, sometimes not. This is very much in keeping with new versions of Windows, Office, and many other applications.
    I don't need white-on-black, but if I have to stare at a glorified light bulb all day, I want it to be as dim as possible, and that's what white-on-black does.

    Here's a discussion on the topic: http://cafe.elharo.com/ui/black-on-white-good-white-on-black-bad/
    bis
    0

Add comment

Please sign in to leave a comment.