-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbListTables: list Materialized Views as well #261
Conversation
There are no |
I'm getting legitimate Travis errors: https://travis-ci.com/github/r-dbi/RPostgres/jobs/391997882#L3128 |
How do you want me to handle this?
Relatedly: Do you already have a policy regarding the use of information schema vs. system catalogs?
Since mviews are PostgreSQL-specific features we need to query the system catalogs. These have the drawback of being less stable, which we see here to some degree. Therefore, alternative no.
BTW Which Postgres versions does RPostgres support? |
A robust solution would be better. We require client libraries >= 9.6, the server version is not specified. Are materialized views contained in |
No, they are not since they are a PostgreSQL-specific feature. For more info, see this thread on the psql-hackers list for a discussion on why they are not in the INFORMATION_SCHEMA.tables (which includes Views). Tl;dr: "They are not defined by the SQL standard." My 2ct: Since RPostgres is a PostgreSQL-specific package, it makes sense to support PostgreSQL-specific features. OTOH: Since it is a DBI package, maybe it might also make sense to only support SQL-standard features (like information schema)? In this particular case I don't expect major changes in the future, but you never know.
Apparently my mental model is off. What do you mean by client libraries? I thought it goes like this: RPostgres - libpq - PostgreSQL server. |
We require libpq >= 9.6 . I'm also worried about Redshift (#215). Can we implement a solution that works on all platforms? |
I am not familiar with Redshift, at all, and don't know how to test ATM. DESCRIPTION says |
I found this:
This links to the Postgres v8.0 docs, however. Like I said, I am not familiar with Redshift, so I don't know whether this is an oversight or not. I think we have a decision though: In order to support system catalogs, which are less stable than information schema, we would have to test against all currently supported server versions. If you want to support Redshift as well, we would need to test against all current Redshift versions as well. This is probably not as easy as spinning up a few docker containers (though I don't know for sure). This sounds very much like "let's not support queries against system catalogs in RPostgres" to me. What do you think? |
Right, 9.0 is stated in DESCRIPTION and in I don't mind implementing Postgres-specific code now that we have |
We could find a middle ground by implementing Postgres-specific functions to gain some experience: Leave |
Sounds good, I think! Just to make sure, you mean:
This involves a bit more than just changing a SQL query, though. E.g. I will have to read up on S4. Also we may have to think about how we setup internal functions like What I am saying is: I won't be able to do this immediately and cannot commit to a time frame at this moment. Also, I may require a bit of support from you. Therefore it's also fine with me, if you want to do this yourself. 😃 |
Probably obvious, but we may need Redshift-specific functions as well, when a query relies on a Postgres function that Redshift does not support, e.g. #211. (Plus unsupported PG data types and features).
Lines 237 to 244 in 12c3d3d
Edit: Not sure what I meant at the time, but looks like I was confused, because #211 is about using |
e62c88b
to
47914c6
Compare
47914c6
to
154eeac
Compare
57df678
to
8e8994f
Compare
…rary also list schemas with materialized views only
I added new pq* versions of Is this, what you had in mind, @krlmlr? At the minimum this needs some more tests to make sure that it does what we are trying to do, i.e. list materialized views as well.
In the end I think it would be better to use this new code for the db* functions instead of having these "special" functions. One reason is ease of use, another is downstream functions (e.g. in dplyr), which build on the db* functions. Slightly off-topic: Do you have plans to test non-current PostgreSQL versions with R CMD check on GHA? I am asking because it was set up on Travis and caught an error I made. |
Thanks a lot. I'm not sure we need the new Other than that, I think we can expose this via the Added checks for Postgres >= 10 to the build matrix. |
Closing this in favour of #414 |
dbListTables()
now uses thepg_class
/pg_namespace
tables instead ofINFORMATION_SCHEMA.tables
to retrieve the names of remote tables and (materialized) views.In particular
dbListTables()
will now list:It does not list the partitions of a partitioned table.