Skip to content

feat: add @pgpm/ltree-helpers — slash/ltree/lquery path conversion#64

Merged
pyramation merged 2 commits intomainfrom
feat/ltree-helpers
May 5, 2026
Merged

feat: add @pgpm/ltree-helpers — slash/ltree/lquery path conversion#64
pyramation merged 2 commits intomainfrom
feat/ltree-helpers

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

New @pgpm/ltree-helpers package in packages/ltree-helpers/ with its own ltree_helpers schema. Provides three IMMUTABLE STRICT SQL functions for converting between user-facing slash paths and PostgreSQL ltree/lquery types:

Function Signature Example
ltree_helpers.to_path (text) -> ltree '/projects/alpha/docs' -> 'projects.alpha.docs'
ltree_helpers.to_slash (ltree) -> text 'projects.alpha.docs' -> '/projects/alpha/docs'
ltree_helpers.to_query (text) -> lquery '/projects/*/docs' -> 'projects.*.docs'

These support the file access system in constructive-db (Phase 2b). The storage module generator will use these to create computed folder columns on files tables, keeping ltree as an internal implementation detail while exposing familiar slash-path APIs.

Includes tests covering basic conversions, edge cases, and roundtrip verification.

Review & Testing Checklist for Human

  • Verify the three functions handle edge cases you care about (empty string, trailing slashes, special characters in path segments)
  • Confirm ltree_helpers schema name is acceptable

Notes

Companion PRs:

  • constructive-db #1007: downstream copy of this module + constructive.control dependency
  • constructive: (forthcoming) add pgpm-ltree-helpers to system modules array and PGPM_MODULE_MAP

Link to Devin session: https://app.devin.ai/sessions/ffa3ed8652fc412f976accbdc229c88d
Requested by: @pyramation

New @pgpm/ltree-helpers package with ltree_helpers schema containing:

- ltree_helpers.to_path(text) -> ltree: slash path to ltree
- ltree_helpers.to_slash(ltree) -> text: ltree to slash path
- ltree_helpers.to_query(text) -> lquery: glob to lquery

Includes deploy/verify/revert scripts, tests, and compiled SQL.
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 5, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtypescript@​5.9.3100100909890

View full report

Matches jwt-claims/stamps pattern — functions called from RLS
policies need to be accessible to authenticated and anonymous roles.
@pyramation pyramation merged commit 0af5bbf into main May 5, 2026
24 checks passed
@pyramation pyramation deleted the feat/ltree-helpers branch May 5, 2026 07:34
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.

1 participant