Skip to content

Allow running one-shot psql commands via castor pg - #428

Merged
lyrixx merged 3 commits into
mainfrom
pg-one-shot-command
Aug 26, 2026
Merged

lyrixx merged 3 commits into
mainfrom
pg-one-shot-command

Conversation

@lyrixx

@lyrixx lyrixx commented Aug 26, 2026

Copy link
Copy Markdown
Member

Same idea as castor builder -- <command>: the castor pg task now accepts anything after -- and proxies it to psql inside the postgres container, in a non-interactive way with the exit code propagated. This makes it easy for agents (and humans) to run queries:

castor pg                          # interactive psql (unchanged)
castor pg -- "SELECT now();"       # one-shot query
castor pg -- -c "\dt"              # raw psql arguments

If the first argument is not an option (does not start with -), the words are re-joined into a single psql -c argument, as the shell splits them into multiple argv entries.

@lyrixx
lyrixx enabled auto-merge August 26, 2026 08:07
@lyrixx
lyrixx disabled auto-merge August 26, 2026 08:08
@lyrixx
lyrixx merged commit f910966 into main Aug 26, 2026
4 checks passed
@lyrixx
lyrixx deleted the pg-one-shot-command branch August 26, 2026 08:09
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