Skip to content

Include views in listed tables? #27

Closed

Description

@currymj

This is also in tidyverse/dplyr#1007 (because it comes up when using the tbl function). I'm mentioning it here because it seems like RPostgres is going to replace RPostgreSQL eventually and might be able to fix the problem.

RPostgreSQL doesn't return views when using dbListTables, which is unexpected for some users. RPostgres uses the same query:

select tablename from pg_tables where schemaname !='information_schema' and schemaname !='pg_catalog';

I'm not sure whether RPostgres should just return views along with the tables, or whether there should be a separate dbListViews function. But I feel like there should be some way to get at them without writing a raw query.

The following gets both views and "real" tables:

SELECT table_name FROM INFORMATION_SCHEMA.tables WHERE table_schema = ANY (current_schemas(false));

Activity

  1. hadley commented on Mar 30, 2015

    @hadley
    Member

    I think it makes sense to have this on by default.

  2. krlmlr commented on Nov 27, 2017

    @krlmlr
    Member

    dbListTables() now also includes views.

  3. github-actions commented on Dec 8, 2020

    @github-actions
    Contributor

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

  4. locked and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions