Skip to content

Commit 57acbbe

Browse files
committed
[scripts] tweak pg-annotate-errors
1 parent 7b325d4 commit 57acbbe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/scripts/pg-annotate-errors.lnav

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#
55

66
;SELECT
7-
'```plpgsql' || char(10) || substr(stmt_body, 1, CASE WHEN error_line_end > 0 THEN char_offset + error_line_end ELSE length(stmt_body) END) || char(10) || '```' || char(10) ||
7+
'```plpgsql' || char(10) || substr(stmt_body, 1, error_line_end) || char(10) || '```' || char(10) ||
88
'> <span style="white-space: nowrap">' || replicate(' ', CASE WHEN error_line_start > 1 THEN error_line_start - 2 ELSE char_offset - 1 END) || '<span class="-lnav_log-level-styles_error">' || replicate('^', coalesce(length(token), 1)) || '</span> ' || err_body || '</span>' || char(10) AS content
99
FROM (
1010
SELECT
1111
token,
1212
err_body,
1313
char_offset,
1414
instr(reverse(substr(stmt_body, 1, char_offset)), char(10)) AS error_line_start,
15-
instr(substr(stmt_body, char_offset), char(10)) AS error_line_end,
15+
coalesce(char_offset + nullif(instr(substr(stmt_body, char_offset), char(10)), 0) - 1, length(stmt_body)) AS error_line_end,
1616
stmt_body
1717
FROM (
1818
SELECT

0 commit comments

Comments
 (0)