Skip to content

feat(system): ENV(name) scalar lookup of one environment variable (S15) - #95

Merged
TimelordUK merged 1 commit into
mainfrom
feat/s15-env-scalar
Sep 28, 2026
Merged

TimelordUK merged 1 commit into
mainfrom
feat/s15-env-scalar

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Summary

  • New ENV(name) scalar: the value of one environment variable of this process, for use inside an expression. environment() (S9) lists them all; this is the lookup S9 kept the name free for.
  • NULL when unset (so COALESCE(ENV('EDITOR'), 'vi') works), '' when set-but-empty, NULL for impossible names (empty, =, NUL), error for a non-string name.
  • Case-insensitive name on Windows via var_os, so ENV('path') finds Path regardless of launching shell; exact on Linux.
  • Registered under a new System function category, behind the system-tables feature.
  • UNNEST(ENV('PATH'), ';') splits PATH with no FROM.

Docs: new S15 entry in docs/SYSTEM_TABLES.md; two queries appended to examples/system_environment.sql.

Test plan

  • 5 unit tests in src/sql/functions/system.rs (reads CARGO_PKG_NAME, never sets vars)
  • ./run_all_tests.sh green (smoke-only note on expander_rewriters Q7, which doesn't use ENV)
  • cargo check --no-default-features --features redis-cache compiles (system-tables off)
  • --function-help ENV and --list-functions show the System category

🤖 Generated with Claude Code

environment() lists every variable; ENV('PATH') returns one inside an
expression. NULL when unset (so COALESCE works), '' when set-but-empty,
case-insensitive name on Windows via var_os. Registered under a new
System category behind the system-tables feature.

UNNEST(ENV('PATH'), ';') now splits PATH with no FROM clause.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@TimelordUK
TimelordUK merged commit 523a037 into main Sep 28, 2026
8 checks passed
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