Gitlab psql
Inspect GitLab GDK PostgreSQL test and development databases with gdk psql. Use for Postgres schema checks, table and index inspection, read-only SQL queries, migration verification, and investigating GitLab application data in local test or development databases.From its SKILL.md
npx -y skills add vershart/gitlab-skills --skill gitlab-psqlAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.1 KB, as published. Nobody here has run it
PostgreSQL Development Skill
Use gdk psql to connect to local GDK PostgreSQL databases for schema inspection or queries.
This skill assumes a GitLab GDK environment with local PostgreSQL access available.
Prefer the test databases to avoid corrupting development data.
Databases
| Database | Name | Use when |
|---|---|---|
| Test CI (default) | gitlabhq_test_ci | CI-related tables (ci_*). Preferred by default. |
| Test | gitlabhq_test | Non-CI tables. |
| Development CI | gitlabhq_development_ci | Need CI data or must test against real seed data. |
| Development | gitlabhq_development | Need non-CI data or must test against real seed data. |
Connect
# Default (test CI)
gdk psql -X -d gitlabhq_test_ci
# Test (non-CI)
gdk psql -X -d gitlabhq_test
# Development CI (only when needed)
gdk psql -X -d gitlabhq_development_ci
# Development (only when needed)
gdk psql -X -d gitlabhq_development
Agent-friendly options
- Use
-Xto ignore~/.psqlrcso formatting and behavior stay predictable. - Use
-P pager=offfor non-interactive commands so output never pages. - Use
-A -F $'\t' -twhen the agent needs raw values instead of formatted tables. - Use
-v ON_ERROR_STOP=1for multi-statement commands so failures stop immediately.
Examples
# Run a single query
gdk psql -X -d gitlabhq_test_ci -P pager=off -c "SELECT version();"
# List tables matching a pattern
gdk psql -X -d gitlabhq_test_ci -P pager=off -c "\dt *ci_runner*"
# Describe a table
gdk psql -X -d gitlabhq_test_ci -P pager=off -c "\d+ ci_runner_machines"
# List indexes on a table
gdk psql -X -d gitlabhq_test_ci -P pager=off -c "SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'ci_runner_machines' ORDER BY indexname;"
# Return raw values in a machine-friendly format
gdk psql -X -d gitlabhq_test_ci -P pager=off -A -F $'\t' -t -c "SELECT id, status FROM p_ci_builds LIMIT 5;"
# Check partitioned index attachments
gdk psql -X -v ON_ERROR_STOP=1 -d gitlabhq_test_ci -P pager=off -c "SELECT parent_idx.relname AS parent_index, child_idx.relname AS attached_index, child_tbl.relname AS partition_table FROM pg_inherits idx_inh JOIN pg_class parent_idx ON idx_inh.inhparent = parent_idx.oid JOIN pg_class child_idx ON idx_inh.inhrelid = child_idx.oid JOIN pg_index pi ON child_idx.oid = pi.indexrelid JOIN pg_class child_tbl ON pi.indrelid = child_tbl.oid WHERE parent_idx.relname = '<parent_index_name>' ORDER BY child_tbl.relname;"
Agent Guidelines
- Use
gdk psql- Prefergdk psqlover rawpsqlso connection details and ports stay implicit. - Prefer test databases - Use
gitlabhq_test_ci(default) orgitlabhq_test. Only use development databases when explicitly asked or when seed data is needed. - Read-only by default - Prefer
SELECT,\d,\dt, and other inspection commands. Only run DDL/DML when explicitly asked. - Use
-Xand-P pager=off- Keep formatting predictable and avoid pager output in non-interactive use. - Use
-cfor single queries - Pass queries via-cflag rather than interactive mode. - Use
-A -F $'\t' -tfor raw values - Prefer compact output when the agent needs data rather than presentation. - Stop on error - When running multiple statements, start with
\set ON_ERROR_STOP onor pass-v ON_ERROR_STOP=1on the command line. - Partitioned tables - Many CI tables are partitioned. Parent indexes (
ON ONLY) may differ from partition-level indexes. Always check both levels when investigating index issues. - Schema reference - The expected schema is defined in
db/structure.sql(non-CI) anddb/ci_structure.sql(CI).