Skip to content

Conversation

@baileych
Copy link
Contributor

Modifies RPostgres' own dbUnquoteIdentifier() to parse catalog.schema.table specifications without each component being enclosed by double-quotes, as required to work with dbplyr.

Fixes r-dbi/DBI#277.

@baileych baileych changed the title bbUnquoteIdentifier dbUnquoteIdentifier May 28, 2019
@baileych
Copy link
Contributor Author

The update breaks an existing test which passes to dbQuoteIdentifier an Id object with a schema name and no table. The resulting SQL string has the form "schema_name"., which does not conform to the dbQuoteIdentifier() spec's requirement that the result be suitable as a table or column name. The new dbUnquoteIdentifier() rejects this as an illegal SQL expression (correctly), but this does mean that a dbQuoteIdentifier()/dbUnquoteIdentifier() round trip for an arbitrary Id object is not guaranteed.

I would argue that the new behavior is correct, given the spec for dbQuoteIdentifier(). If so, the fix is to change the list_objects_features test in spec-sql-list-objects.R to attempt quoting/unquoting only objects that have a table name (i.e. is_prefix is false).

If the preference is to retain the roundtrip rather than a valid SQL expression, the fix is to change the regex in dbUnquoteIdentifier() to accept zero or more characters after a . rather than 1 or more.

krlmlr added a commit that referenced this pull request Aug 23, 2019
@krlmlr krlmlr merged commit 3057fb3 into r-dbi:master Aug 23, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dbUnquoteIdentifier() too stringent

2 participants