How can I write in RPostgreSQL's dbListTables() function to get the same results as PostgreSQL's native /dt *name_pattern* command?
I have connected to my company's PostgreSQL database using the RPostgarSQL package. I would like to list tables that match certain naming patterns using the dbListTable() function. In native PostgreSQL environment, I can just use psql command
to find tables. How can I do the same thing using RPostgreSQL::dbListTable()?
Most of the information you can get from psql's \d... commands comes from the tables in information_schema. In your case you can do this:
SELECT table_name FROM information_schema.tables WHERE table_name LIKE '%foo%'