diff --git a/src/internals/sql-ref.rst b/src/internals/sql-ref.rst index 15644c5f..784dde68 100644 --- a/src/internals/sql-ref.rst +++ b/src/internals/sql-ref.rst @@ -4634,20 +4634,11 @@ from *table* .. code-block:: custsqlite - ;from db.http_status_codes | take 3 - ✘ error: failed to compile SQL statement - reason: no such table: db.http_status_codes - --> command:1 - | SELECT - | * - | FROM - | db.http_status_codes - | LIMIT - | 3 - | - | -- Generated by PRQL compiler version:0.11.5 target:sql.sqlite (https://prql-lang.org) - | - + ;from http_status_codes | take 3 + status message + 100 Continue + 101 Switchi⋯otocols + 102 Processing To use an array literal as a source: diff --git a/src/readline_highlighters.cc b/src/readline_highlighters.cc index e299824d..be55d204 100644 --- a/src/readline_highlighters.cc +++ b/src/readline_highlighters.cc @@ -280,9 +280,7 @@ readline_sqlite_highlighter_int(attr_line_t& al, int x, line_range sub) || attr.sa_type == &lnav::sql::PRQL_NUMBER_ATTR) { alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_NUMBER)); - } else if (attr.sa_type == &SQL_STRING_ATTR - || attr.sa_type == &lnav::sql::PRQL_STRING_ATTR) - { + } else if (attr.sa_type == &SQL_STRING_ATTR) { if (lr.length() > 1 && al.al_string[lr.lr_end - 1] == '\'') { alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_STRING)); } else { @@ -291,6 +289,8 @@ readline_sqlite_highlighter_int(attr_line_t& al, int x, line_range sub) alb.overlay_attr_for_char(lr.lr_start, VC_ROLE.value(role_t::VCR_ERROR)); } + } else if (attr.sa_type == &lnav::sql::PRQL_STRING_ATTR) { + alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_STRING)); } else if (attr.sa_type == &SQL_OPERATOR_ATTR || attr.sa_type == &lnav::sql::PRQL_OPERATOR_ATTR) { diff --git a/src/sql_commands.cc b/src/sql_commands.cc index b6fba63a..9f808e95 100644 --- a/src/sql_commands.cc +++ b/src/sql_commands.cc @@ -485,7 +485,7 @@ static readline_context::command_t sql_commands[] = { .with_parameter({"table", "The table to use as a source"}) .with_example({ "To pull data from the 'http_status_codes' database table", - "from db.http_status_codes | take 3", + "from http_status_codes | take 3", help_example::language::prql, }) .with_example({ diff --git a/src/sql_util.cc b/src/sql_util.cc index 67cbde20..ce17d9b2 100644 --- a/src/sql_util.cc +++ b/src/sql_util.cc @@ -1397,7 +1397,7 @@ annotate_prql_statement(attr_line_t& al) &PRQL_STRING_ATTR, }, { - lnav::pcre2pp::code::from_const(R"(\A(?:f|r|s)?\"([^\"]|\\.)*\")"), + lnav::pcre2pp::code::from_const(R"(\A(?:f|r|s)?"([^\"]|\\.)*")"), &PRQL_STRING_ATTR, }, {