postgresql variable in query. This might be an edge case, > i