Skip to content

docs: clarify schema discovery for dbListTables - #583

Closed
LeonidasZhak wants to merge 2 commits into
r-dbi:mainfrom
LeonidasZhak:codex/docs-schema-table-discovery
Closed

LeonidasZhak wants to merge 2 commits into
r-dbi:mainfrom
LeonidasZhak:codex/docs-schema-table-discovery

Conversation

@LeonidasZhak

Copy link
Copy Markdown
Contributor

Summary

Clarify how to discover tables in a non-default schema, both by listing objects with Id(schema = ...) and by using options = "-c search_path=..." for a connection.

Thanks to maintainers

Thanks for the pointers in #399 and for the existing schema-qualified table examples.

Issue or motivation

Issue #399 notes that users looking for tables in a specific schema do not easily find the supported workflows.

Root cause

The connection docs only pointed readers to the general libpq options reference, and the table docs showed schema-qualified writes without showing the matching schema-scoped listing patterns.

Change

  • document options = "-c search_path=..." in the dbConnect() docs with a runnable example
  • extend the table docs to show dbListObjects(con, Id(schema = ...)) and dbListTables() on a connection with search_path set
  • add a focused test covering the documented search_path workflow

Tests

  • devtools::document()
  • UserNM=true R CMD INSTALL .
  • devtools::test(filter = "dbConnect")
  • rcmdcheck::rcmdcheck(args = c("--no-manual", "--ignore-vignettes"), error_on = "note")
  • pkgdown::build_site(preview = FALSE)

Scope

I did not change dbListTables() behavior or add a new schema argument. This PR only documents the existing workflows and adds a focused regression test for the documented connection-option path.

@LeonidasZhak
LeonidasZhak force-pushed the codex/docs-schema-table-discovery branch from 4ef8962 to 5c31346 Compare June 22, 2026 03:48
@LeonidasZhak
LeonidasZhak force-pushed the codex/docs-schema-table-discovery branch from 5c31346 to 7506a94 Compare September 25, 2026 15:06
@LeonidasZhak

Copy link
Copy Markdown
Contributor Author

I checked the failed format-suggest run on the current head. It stops before formatting: GitHub Actions cannot find the local action at ci-base/.github/workflows/style (action.yml/action.yaml/Dockerfile missing). This looks like the upstream workflow checkout/path setup rather than a formatting diagnostic in this docs change. Could a maintainer check the action path or advise whether the job should be rerun?

krlmlr added a commit that referenced this pull request Nov 29, 2026
* chore: Review #583 [ci skip]

Records the review of #583 on its PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc

* docs: clarify schema table discovery

* style: wrap schema cleanup call

* docs: Show the schema example once and say that `search_path` replaces the path

Keeps the full example in `?postgres-tables` only and links to it from `?Postgres`.
The `search_path` example keeps `public`,
quotes the schema with `dbQuoteIdentifier()`,
and the claim stays out of the `...` parameter that `?Redshift` inherits.
The example creates a schema with a unique name and removes only what it created.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc

* test: Slim the schema listing test

Cleans up with `withr::defer()`, creates a uniquely named schema without a preceding `DROP`,
and removes only what it created, so the test prints no server notices.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc

* docs: Name the servers that need `SET search_path` and test the `public` form

Says that `dbListTables()` skips `pg_catalog`,
and covers `search_path=<schema>,public` in the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd6e5NcxC9GSrNJDokc

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Leonidas Zhak <[email protected]>
@krlmlr

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member

Thanks! Expanded and merged with attribution in #583.

@krlmlr krlmlr closed this Nov 29, 2026

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member

Thank you for picking up #399, and sorry for the slow reply! The content was accurate, so I took your two commits, with you as their author, into #675 and made a few changes on top:

  • -c search_path=myschema replaces the search path, so the example now uses myschema,public to keep the tables in public visible.
  • The full example now lives only in ?postgres-tables, and ?Postgres links to it. This also keeps the claim out of the ... parameter that ?Redshift inherits.
  • The example quotes the schema with dbQuoteIdentifier(), creates a uniquely named schema, and removes only what it created.
  • The roxygen uses semantic line breaks, and the test is shorter.

The format-suggest failure here was a problem in our workflow, and it has been fixed on main since. I'm closing this in favor of #675, which is now merged. Thanks again!


Generated by Claude Code

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

Successfully merging this pull request may close these issues.

2 participants