Repository navigation
feat(system): environment() table function (S9) - #94
Merged
Merged
Conversation
… (S9)
One row per inherited variable: name, value, sorted case-insensitively by
name. Same two columns on every platform, behind the system-tables feature.
- Windows' hidden per-drive `=C:` variables are skipped (not configuration,
no Linux equivalent - the S1 "same kind of row?" rule).
- An empty value stays '' rather than NULL: on Unix set-but-empty differs
from unset.
- Non-UTF-8 values are converted lossily, never dropped.
- Named environment() rather than env() to keep ENV('X') free for a scalar.
Documented in docs/SYSTEM_TABLES.md, including that Windows name case
follows the launching shell (Path from PowerShell, PATH from Git Bash).
Verified on Windows 11 and Linux (WSL2).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
environment()besideprocesses()andsockets(): one row per environment variable thesql-cliprocess inherited.name,value; the same on every platform, sorted case-insensitively by name.=C:variables are skipped.''rather than NULL, because on Unix set-but-empty is different from unset.environment()rather thanenv()to keepENV('X')free for a scalar lookup.Pathfrom PowerShell,PATHfrom Git Bash). UseUPPER(name)in portable queries.Docs: S9 in
docs/SYSTEM_TABLES.md; examples inexamples/system_environment.sql.Test plan
environment_lists_what_this_process_inheritedpasses on Windows 11 and on Linux (WSL2); all system tests pass on LinuxFOO=returns''with length 0, and PATH splits on:cargo clippy: no new warnings./run_all_tests.shpasses. One smoke test,expander_rewriters, fails on a GROUP BY error; it also fails without this change.🤖 Generated with Claude Code