This works:
SELECT * FROM aTable WHERE junk='foo bar';
This hangs for ever:
SELECT * FROM aTable WHERE junk~'foo bar';
This hangs for ever:
SELECT * FROM aTable WHERE junk~'foo b.*';
What is wrong?
EDIT: is there ever a situation where the sql query is submitted but no reply is ever given? For example infinite loops, bad syntax etc.
There is nothing wrong.
Neither of your 2 queries that use regular expressions can be optimized using indexes.
So you have full scan as a result, thus it takes some time.