Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/readline_callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,12 @@ rl_sql_change(textinput_curses& rc, bool is_req)
if (!is_req && attr_iter->sa_type == &SQL_HEX_LIT_ATTR
&& attr_iter->sa_range.length() == 2)
{
} else if (is_req
|| (attr_iter->sa_type != &SQL_NUMBER_ATTR
&& attr_iter->sa_type != &SQL_HEX_LIT_ATTR)
|| rc.tc_popup_type
== textinput_curses::popup_type_t::completion)
} else if (attr_iter->sa_type != &SQL_GARBAGE_ATTR
&& (is_req
|| (attr_iter->sa_type != &SQL_NUMBER_ATTR
&& attr_iter->sa_type != &SQL_HEX_LIT_ATTR)
|| rc.tc_popup_type
== textinput_curses::popup_type_t::completion))
{
auto to_complete_sf
= anno_line.to_string_fragment(attr_iter);
Expand Down
5 changes: 5 additions & 0 deletions test/test_sql_anno.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,8 @@ take 10
run_cap_test ./drive_sql_anno "SELECT * FROM customers LIMIT 1"

run_cap_test ./drive_sql_anno "SELECT * FROM customers FULL JOIN all_logs pg_stmt_log ON (pg_stmt_log.log_text LIKE '%STATEMENT:%') LIMIT 1"

# the trailing ';' must be annotated as garbage so that the SQL completion
# trigger in rl_sql_change() does not offer suggestions at the statement
# terminator (see #1751)
run_cap_test ./drive_sql_anno "SELECT * FROM caddy_log WHERE 1=1;"