puppetlabs / puppetlabs/puppetlabs-postgresql

GRANT ON TABLE including schema always fails.

Open
#1,642 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
232
Forks
610
Avg merge
5d 23h
Merged PRs (30d)
4

Description

Describe the Bug

postgresql::server::table_grant { 'grant test':
privilege => 'ALL',
table => 'my_schema.my_table',
db => 'my_database',
role => 'my_role'
}

generates:

# GRANT ALL ON TABLE "my_schema.my_table" TO "my_role";
ERROR:  relation "my_schema.my_table" does not exist

the issue being that when including a schema the schema with table cannot be enclosed in double quotes.

The grant is not reported as unsuccessful - that is puppet runs without error even though the grant failed.

# GRANT ALL ON TABLE my_schema.my_table TO "my_role";
GRANT

Expected Behavior

The capabilities are granted to the user.

Steps to Reproduce

create a schema
create a table
grant access to a role of the schema.table

Environment

Rocky 9
Puppet Server 8.7.0
Postgresql module 10.5.0

Additional Context

None.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the postgresql::server::table_grant resource and the generated GRANT ON TABLE statement. Reproduce the schema-qualified table case from the issue, then verify that the schema and table are quoted separately and that a failed grant is reported as unsuccessful.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, ruby
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.