Skip to content

Commit 2af51c2

Browse files
author
Ekaterina Sokolova
committed
Fix bug with select * from pg_sleep();
1 parent fc12c98 commit 2af51c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pg_query_state.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,8 @@ CountNodeProgress(char *node_text)
12661266
rows = (char *) (strstr(node_text, "\"Actual Rows\": ") /* pointer to "Actual Rows" */
12671267
+ strlen("\"Actual Rows\": ") * sizeof(char)); /* shift by number of actual rows */
12681268
len = strstr(rows, "\n") - rows;
1269-
if ((strstr(rows, ",") - rows) < len)
1270-
len = strstr(rows, ",") - rows;
1269+
if (strstr(rows, ",") != NULL && (strstr(rows, ",") - rows) < len)
1270+
len = strstr(rows, ",") - rows;
12711271
actual_rows_str = palloc(sizeof(char) * (len + 1));
12721272
actual_rows_str[len] = 0;
12731273
strncpy(actual_rows_str, rows, len);

0 commit comments

Comments
 (0)