Skip to content

Comments

fix: proc visibility#36

Merged
tianzhou merged 1 commit intomainfrom
proc_permission
Sep 23, 2025
Merged

fix: proc visibility#36
tianzhou merged 1 commit intomainfrom
proc_permission

Conversation

@tianzhou
Copy link
Contributor

Fix #34

Copilot AI review requested due to automatic review settings September 23, 2025 16:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes procedure and function visibility issues by changing the SQL queries to use p.prosrc instead of r.routine_definition from the information schema. This addresses cases where routine_definition returns NULL for procedures/functions owned by restricted roles, while p.prosrc provides reliable access to the source code.

Key changes:

  • Updated SQL queries to use pg_proc.prosrc instead of information_schema.routines.routine_definition
  • Changed Go struct field types from interface{} to string for routine definitions
  • Removed permission validation logic that was causing errors when routine_definition was NULL
  • Updated tests to verify that procedure/function source is accessible via the new approach

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/queries/queries.sql Updated SQL queries to use p.prosrc AS routine_definition instead of r.routine_definition
internal/queries/queries.sql.go Generated code reflecting SQL changes and type updates from interface{} to string
internal/queries/models.sql.go Updated sqlc version from v1.29.0 to v1.30.0
internal/queries/dml.sql.go Updated sqlc version from v1.29.0 to v1.30.0
internal/ir/inspector.go Removed permission validation logic and simplified routine definition handling
cmd/dump/dump_permission_integration_test.go Replaced permission error tests with tests verifying source code accessibility via p.prosrc

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tianzhou tianzhou merged commit 26886e1 into main Sep 23, 2025
2 checks passed
@tianzhou tianzhou deleted the proc_permission branch October 23, 2025 09:15
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.

pgschema can't read procedure definitions which psql can read

1 participant