database: don't ignore unknown sub expressions in alternate
Created by: keegancsmith
A customer was running into an issue where we didn't search all repositories. They were using a more complicated regexp query for the repo clause. The root cause was we ignored parts of the sub expression. This commit makes us fallback to just using postgres's regex engine in those cases.
This code really does need a rewrite, I can think up many cases where it breaks. However, it has been running without much reports for a long time so I just fixed this for now.
Test Plan: unit test added
plz-review-url: https://plz.review/review/6591