--- /dev/null
+FE=> Query(query="SET statement_timeout = '4s'")
+<= BE CommandComplete(SET)
+<= BE ReadyForQuery(I)
+FE=> Parse(stmt="S1", query="SELECT 1/0")
+FE=> Bind(stmt="S1", portal="")
+FE=> Execute(portal="")
+FE=> Close(stmt="S1")
+FE=> Parse(stmt="S2", query="SELECT * from pg_tables")
+FE=> Bind(stmt="S2", portal="")
+FE=> Execute(portal="")
+FE=> Close(stmt="S2")
+FE=> Sync
+<= BE ParseComplete
+<= BE ErrorResponse(S ERROR V ERROR C 22012 M division by zero F int.c L 704 R int4div )
+<= BE ReadyForQuery(I)
+FE=> Terminate
--- /dev/null
+# Test data for 0000370:
+# SQL error followed by normal SELECT gets stuck.
+
+# Test data for 0000370:
+# SQL error followed by normal SELECT gets stuck.
+
+'Q' "SET statement_timeout = '4s'"
+
+# Receive response from backend
+'Y'
+
+'P' "S1" "SELECT 1/0" 0
+'B' "" "S1" 0 0 0
+'E' "" 0
+'C' 'S' "S1"
+
+'P' "S2" "SELECT * from pg_tables" 0
+'B' "" "S2" 0 0 0
+'E' "" 0
+'C' 'S' "S2"
+
+# Issue Sync message
+'S'
+
+# Receive response from backend
+'Y'
+# Send terminate message
+'X'