Fix for bug with postgresql repo query (merging from upstream sample)