replace dummy metasql with pg-style query parameterization