Search code examples
rdplyrrpostgresql

View a list of all schema in a PostgreSQL database in r?


I'm connecting and querying a PostgreSQL database through the dplyr package in R. I know I can list all the tables in the database using dbListTables(con). But, my tables are organized into different schema. What is the easiest way I can view all of the schema that are present in my database using R?


Solution

  • dbGetQuery(con, "SELECT nspname FROM pg_catalog.pg_namespace")