[#1871] Add function to extract table names from SQL statement

The function performs an EXPLAIN query with the provided statement and
parses its output looking for table names. It requires Postgres >= 9.x,
as it uses the FORMAT JSON option to get and parse a JSON objects.
 [#1871] Disallow DataStore SQL queries involving system tables

 Using the `get_table_names_from_sql` helper function before running the
 provided statement, we raise a Validation error if some of the tables
 start with `pg_`.

Conflicts:
	ckanext/datastore/db.py
	ckanext/datastore/tests/test_search.py
[#1871] Fix tests

PEP9 and skip the get table names tests if running on legacy mode.

Conflicts:
	ckanext/datastore/tests/test_helpers.py
[#1871] Fix wrong call in tests
[#1871] Add import lost during bad merge