sosedoff/pgweb — pull request #67 by cbandy (2014-11-21 06:13:34+00:00)
Title: Build queries using parameters

Some changes leading up to support for multiple schemata.

The built-in queries will get more complex as we check schema name in addition to table name, so I did the following:

1. Remove "background" queries from the history. They are becoming longer than one line and are probably not interesting to end users. I can revert this change if you like.
2. Move queries inline. It seemed appropriate to keep the SQL near its arguments for a variety of reasons, and none of the constants were used more than once. I can revert this change if you like.
3. Search path in connection info. The configured search path is important when dealing with multiple schemata, and it was easy to add. It is a Postgres `text[]`, so it renders with braces and commas, e.g. `{a,b,c}`. This seemed "good enough" to me, but if you like, we can find a nicer way to display this.

It's not possible to pass an identifier as a query parameter, so `SELECT COUNT(*) FROM $1` doesn't work. I went ahead and changed this query to read from statistics since it falls down on large tables anyway. I changed the label in the UI to reflect this difference, but did not regenerate `bindata.go`. Shall I add that to this PR?