Skip to content
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

dbSchema() returns NULL instead of FALSE when schema does not exist in database #29

Closed
mac471 opened this issue Jan 25, 2023 · 1 comment

Comments

@mac471
Copy link

mac471 commented Jan 25, 2023

I am using dbSchema() to check for the existence of a schema name before attempting to pgInsert() to it. The documentation says that dbSchema() will return FALSE if the schema does not exist but it is returning NULL instead. I am running PostgreSQL 15 on a iMac (late 2015) that is running macOS Monterey. The client end is calling dbSchema() from a MacBook Pro running R 3.5.1 and rpostgis version 1.4.3.

@basille
Copy link
Collaborator

basille commented Jan 30, 2023

Thanks for the report! As a matter of fact, the documentation says that dbSchema returns TRUE if the schema exists (whether it already existed, or was just successfully created), but does not specify what happens if the schema does not exists and is not created (i.e. with exec = FALSE). In this case, the DB returns NULL and rpostgis just transfers the answer. To be honest, not sure there's a need to do anything about it.

Or maybe I'm missing something about what you're trying to achieve. If that is the case, please elaborate and provide functional code (reproducible might be difficult because of the DB connection).

(also please read #28 about the future of rpostgis)

@basille basille closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants