feat: add graphile-ltree plugin — auto-detect ltree columns, folder fields, containment/glob filters#1056
Merged
pyramation merged 2 commits intomainfrom May 5, 2026
Merged
Conversation
…ields, containment/glob filters
- LtreeCodecPlugin: ensures ltree codec is properly registered with PostGraphile's native LTree scalar
- LtreeExtensionDetectionPlugin: detects ltree extension by scanning pgRegistry codecs
- LtreeFolderFieldPlugin: adds virtual {column}Folder fields with slash-delimited paths
- Connection filter operators: isAncestorOf (<@), isDescendantOf (@>), matchesGlob (~)
- Glob semantics: * = single level (*{1} in lquery), ** = recursive descent
- Bundled into GraphileLtreePreset and wired into ConstructivePreset
- Added to CI test matrix in run-tests.yaml
- 9 integration tests covering scalar type, folder fields, and all filter operators
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…erators GraphileFolderPreset extends GraphileLtreePreset with: - Renames ltree columns via @name tag: path → pathTree (dot-delimited) - Adds virtual folder field with clean name: path (slash-delimited) - Registers folder operators on LTree: within, ancestorOf, glob - All folder operators accept slash-delimited paths Two-preset architecture: - GraphileLtreePreset: base ltree operators (isAncestorOf, isDescendantOf, matchesGlob) - GraphileFolderPreset: folder layer (includes base + folder fields + folder operators) ConstructivePreset now uses GraphileFolderPreset for the full folder experience.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
graphile-ltree— a PostGraphile v5 plugin for ltree columns with two presets:GraphileLtreePreset(base) — raw ltree operators on the native LTree scalar:isAncestorOf(containment<@),isDescendantOf(@>),matchesGlob(lquery~)GraphileFolderPreset(extends base) — folder-oriented layer:@nametag:path→pathTree(dot-delimited raw ltree)path(slash-delimited, e.g./projects/alpha/docs)within,ancestorOf,glob(accept slash paths)*= single level,**= recursiveBoth presets auto-detect ltree columns by scanning pgRegistry — no smart tags or config needed. Uses
ltree_helpers.to_query()when available, inline SQL fallback otherwise.ConstructivePresetnow usesGraphileFolderPresetfor the full folder experience.New package at
graphile/graphile-ltree/with 5 plugins, 13 integration tests, added to CI matrix.Review & Testing Checklist for Human
pathreturns slash-delimited values andpathTreereturns dot-delimited raw ltreewithin,glob,ancestorOf) correctly accept slash-delimited paths*wildcard matches single level only (not recursive) — this was a bug that's now fixedNotes
Depends on
pgpm-ltree-helpersmodule (PR #1055, merged) for server-side path conversion. The glob→lquery conversion fix (*→*{1}) is also applied in the upstream helpers (constructive-db PR #1007, pgpm-modules PR #65).Link to Devin session: https://app.devin.ai/sessions/ffa3ed8652fc412f976accbdc229c88d
Requested by: @pyramation