Using postgres I have wrote a query to list the tables inside a database
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema NOT IN
('pg_catalog', 'information_schema');
Query returns results from the wrong database. It automatically selects the first database from the list of databases in postgres.
How do I specify the database to query? 'j220190_data' being the database to query
I've tried things like:
SELECT table_name
FROM information_schema.tables
WHERE Databases = 'j220190_data'
AND table_schema NOT IN
('pg_catalog', 'information_schema');
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE' AND
WHERE Databases = 'j220190_data'
AND table_schema NOT IN
('pg_catalog', 'information_schema');