Skip to content

pgman v0.5.3

Choose a tag to compare

@github-actions github-actions released this 14 Nov 20:21
· 44 commits to main since this release

Added

  • Hibernate logs in Log4j's %p [%c] %m pattern (DEBUG [org.hibernate.SQL] select …) are read, their binds paired with the
    statement on its thread.
  • \report follows the findings table with each advisor finding's
    evidence: the window, the numbers, the setting it would change, the
    suggestion and the statement that read them.
  • MCP schema_lint runs the configuration advisor too, as the TUI's
    wizard does: its ADV findings, each with the window its numbers
    cover, the numbers, the statement that read them and the setting it
    would change; advisor_errors names a check the role couldn't read.
  • A masking rules file asked about again, changed since it was
    confirmed, says first what changed: what it now also keeps that the
    defaults would mask, and what it no longer keeps (at a terminal and
    in MCP's question). Each confirmation goes in the journal as a
    rules event.
  • A masked dump's journal event records which rules masked it (the
    rules file's sha256, or defaults) and whether the operator had
    confirmed that file; pgman copies show says so, and the JSON report
    and CloudWatch carry it.
  • The TUI's footer shows EXPIRED ×N while N dump copies are past
    their expiry with something left to delete (pgman copies prune).
  • pgman copies prune: deletes every copy past its expiry, with the
    databases restored from it, as copies rm does, asking about each in
    turn unless --yes. A copy kept (not confirmed, sessions open)
    doesn't stop the rest. pgman copies points at it under the list.
  • MCP explain suggests an index for a big sequential scan filtered by
    plain comparisons on columns no index of its table leads with: the
    CREATE INDEX CONCURRENTLY that could serve it, to weigh rather than
    run as-is.
  • A patch dry run (pgman apply --dry-run, MCP apply_patches with
    mode: "dry_run") now says what its patches change in the schema —
    tables, columns, keys, indexes, CHECKs and functions added, dropped or
    changed, views redefined — read in its transaction before the
    rollback. The TUI's patch view (P) lists
    them too.
  • pgman diff <A> <B> and MCP schema_diff: what differs between two
    databases' schemas — tables and views in one only, and per table,
    columns added, dropped or changed, the primary key, indexes, foreign
    keys and CHECK constraints; views defined differently; functions in
    one only or defined differently. For drift between environments; a
    report, not a migration.
  • pgman query --target ENV/DATABASE (and --batch --target): run a
    statement against an environment's database, or a connections.toml
    name, with its secret and ssh tunnel, as pgman dump reaches it.
    Read-only unless --primary names the primary (its replica, or its
    primary when it has none); a protected environment is read-only even
    then, since --yes can't answer its typed name (pgman run asks for
    it). A script can't lift it (SET TRANSACTION READ WRITE, a
    COMMIT and a fresh transaction, …), as under a read-only
    safety.toml profile. safety.toml's ENV/DATABASE keys apply.
  • MCP explain: one statement's plan, with findings — big sequential
    scans, row estimates ten times off, sorts and hashes spilled to disk,
    nested loops run thousands of times. analyze: true runs it in the
    read-only session query uses, for actual rows and times.
  • MCP slow_queries: the statements pg_stat_statements says cost the
    most, by total or mean time, as the TUI's slow-query panel reads them,
    for an agent to find the code that sends them.
  • MCP describe: the tables a connection can see (kind, column count,
    size), or one table in full — columns, primary key, foreign keys both
    ways, indexes, size, partitions and its CREATE statement — from the
    catalog read the schema browser makes. An agent no longer hand-writes
    information_schema queries through query.
  • pgman doctor: what pgman sees from the directory it runs in — each
    config file and whether it loads (exit 1 when one doesn't), the
    programs it runs and where they are, and every connection it knows,
    usable or why not. It connects to nothing and names where a password
    comes from, never the password.
  • The environments overview (E) lists the connections.toml entries
    no environment names, under connections, and connects to them with
    their tunnel, secret and password_env: a first connection no longer
    needs an environments.toml too. The empty picker and the start card
    point at it.
  • MCP's dump fills in the agent's reason (or the branch's ticket id)
    as the default of the operator's reason field, so the operator
    confirms it or edits it instead of retyping it. The operator still
    confirms every dump, and what they send is recorded. A suggestion the
    journal wouldn't take (over-long, several lines) isn't filled in.
  • restore_confirm = "clean_only", on a connection in connections.toml
    or an environment in environments.toml, lets MCP's restore create a
    new database on this machine without asking the operator (create,
    no clean, nothing of that name there). A clean, a restore into an
    existing database, and anything protected or off this machine are
    still asked about. The result says it ran unasked; the journal
    records it as before. Only the operator's own files can set it.

Changed

  • The advisor's dead-tuple finding (ADV003), when autovacuum is behind,
    suggests VACUUM (VERBOSE) on the table, which reports the dead rows
    it can't remove yet and the oldest xmin holding them. It suggested a
    lower scale factor, which only starts a vacuum already due.
  • A cell edit's confirmation names the column both ways when the
    result shows it under another name than the schema pgman read: an
    alias, or a column renamed since (S, then r, reloads it). The
    UPDATE goes by pgman's name, which the confirmation alone showed.
  • D with a pinned A from another table (or sharing no column with the
    current result) pins the current result as the new A, and says so.
    It diffed them, every row removed and added.
  • A cell edit whose UPDATE matched no row now says a row-level
    security policy may be why (one can show a row and not let it be
    updated), as well as the row being deleted or its key changed.
  • A rules file's confirmation lists every rule it sets, not only keep,
    null, fixed and hash. A postcode, year or date.shift is
    listed with what it keeps, because on a column the defaults mask whole
    it keeps more than they do: postcode keeps all but the last three
    characters of a value with no space in it. Such a file is no longer
    used unconfirmed without a terminal unless the environment is
    unattended. The confirmation also says a kept column keeps what a
    foreign key joins to it, and the dump's summary lists those columns.

Fixed

  • pgman copies rm leaves a file a later dump wrote over: deleting an
    older copy whose path a newer dump reused deleted the newer dump.
    copies no longer panics on a hand-edited journal with a non-ASCII
    copy id.
  • The editor's completion popup keeps each row's name after Tab picks
    one. Every row read as the pick plus its own ending
    (customerstotals for customer_totals).
  • Editing a temporary table's cell works. Every edit was rolled back
    as "the table changed since pgman read it", which a schema reload
    couldn't help: the catalog calls the session's temporary schema
    pg_temp_4, the server's identity check pg_temp.
  • Masking keeps a flag named for pay or an identifier
    (pay_invoices_online): a boolean holds neither.
  • Masking keeps a number that measures beside a location or photo word
    (geo_status_timeout, photo_count); a coordinate, its minutes and
    seconds and a bounding box's edges (lat_min) are still removed.
  • Masking keeps a number that measures a secret rather than holds one
    (access_token_lifespan, sso_session_idle_timeout,
    otp_attempts), as it already kept a date or an interval. Odoo's
    ir_attachment.store_fname, a file's name, no longer gets a fake
    first name (which broke every attachment's path).
  • An edited cell is sorted and filtered by its new value: the row moves
    where the grid's sort puts it, with the selection on it, or is hidden
    when the filter no longer matches (the status says so). A rollback
    puts it back. They held for the old value.
  • Ctrl-C in row detail cancels a cell edit saved there that is
    waiting (a row lock), as it does from the grid. It armed quit.
  • The INSERT yank (I), :fixture and cell editing resolve an
    unqualified table along the session's search_path, as the server
    does; it was always taken for public. :fixture keeps a schema
    other than public in its element name (audit.events), which the
    apply reads back; it dropped it.
  • JOIN … ON completion offers a multi-column foreign key as one
    predicate (i.order_no = o.no AND i.order_region = o.region), its
    pairs in the key's order. It offered each pair alone, and one pair
    joins the wrong rows.
  • The schema wizard (W) no longer runs its live checks and the
    config advisor inside a transaction you opened: they read its
    statistics as of its start, and one that failed (a timeout, a view
    the role can't read) aborted the transaction. It says so; r runs
    them once it ends.
  • A session pinned read-only because the server was a standby asks
    again when it reconnects (r, \c): a standby promoted since is
    writable as its profile says. An environment's replica stays pinned.
  • With DNS down (a VPN off), dump, restore and run no longer
    stall before their first prompt: protection resolves each server's
    name once per run, for at most 2 seconds, then matches it by its
    name as it does a name that doesn't resolve.
  • The advisor's temp-file finding (ADV002) suggests work_mem for the
    role whose spills a raise can cover. It named the worst spiller's
    role even when that statement spilled more than 4× work_mem, past
    any safe setting; that one is now named apart, to look at its
    statement.
  • The schema wizard (W) says on its bottom border how many lines of
    the focused finding a short terminal cuts. The detail strip just
    stopped.
  • Filtering the grid after scrolling down a long result shows the
    matches from the top. Only the last match showed, with blank rows
    under it.
  • The result diff (D) matches B's columns to A's by name when a query
    lists the same columns in another order, so it keys on the primary
    key and compares column by column. Every row read as removed and
    added.
  • The result diff (D) says when a side held only the rows fetched so
    far (a capped or paged result), and that a row past its end reads as
    added or removed. A pinned side forgot it was partial.
  • The result diff (D) no longer keys rows on a column holding a NULL
    (one NULL on each side paired two unrelated rows), and a change line
    shows text reading NULL as 'NULL', apart from SQL NULL.
  • A cell edit the server refuses (an invalid number, a constraint)
    opens the editor again holding what was typed, with the error below.
    It closed, and the value had to be typed again.
  • MCP query and explain say why when the read-only session refuses
    a statement that writes (a function's INSERT, nextval): MCP runs
    every query read-only, and schema changes go through
    apply_patches. They gave the server's message alone.
  • The row-as-INSERT yank (I), :fixture and cell editing no longer
    take a subquery's alias, a function or a CTE for a table:
    SELECT * FROM (SELECT …) sub was read as public.sub, which
    doesn't exist. They now say they need a single-table result.
  • The sessions panel (L) stays open when it can't read
    pg_stat_activity and says why, as the slow-query panel does. It
    used to close at once, so the q pressed to close it quit pgman.
  • A statement starting explain8 (EXPLAIN's letters, then more) sent
    the safety classifier into endless recursion and crashed pgman with a
    stack overflow; a long run of EXPLAIN EXPLAIN … recursed as deep.
    Found by the new fuzz job's first run; the classifier now strips
    EXPLAINs in a loop and calls such a statement Other.
  • The unknown-command message now lists key (and doctor) with the
    other commands.
  • A DSN with no password stopped at "password missing" with no hint.
    It now says where a password can come from: the DSN, PGPASSWORD, or
    a connection's password_env or secret.
  • pgman query --dsn URL 'SELECT 1' and pgman query --json 'SELECT 1'
    were refused, the SQL taken for a DSN: the SQL had to come first. It
    is now the first argument that isn't a flag, a flag's value or a
    postgres:// DSN, wherever it comes.
  • Masked dumps now mask a few more personal columns by name: WhatsApp
    numbers, Instagram, Facebook, TikTok, Telegram and Snapchat handles,
    and what someone typed into a form (custom_field_values.value,
    survey_answers.answer, a response's response).
  • Masked dumps kept Flyway's installed_by and Liquibase's author
    as they were (people's names, in every row), since a migration tool's
    table is kept whole. Who ran a migration is now pgman.
  • A masked dump's schema now leaves out subscriptions
    (--no-subscriptions, pg_dump 10 on): dumped as a superuser, their
    connection strings can hold another server's password.
  • A masked dump of a PostgreSQL 18 table with a virtual generated column
    copied the column and named it in COPY … FROM, which PostgreSQL
    refuses, so the table's restore failed. Virtual generated columns are
    left to the server, as stored ones are.
  • pgman ran git status and git log in the checkout to check a rules
    file, so a .git/config an agent wrote (an fsmonitor hook, a clean
    filter, a signature check's program) could run a program with the MCP
    server's environment. Every git pgman runs now turns those off, and
    "committed as it is" compares the file with its blob in HEAD instead
    of asking git status.
  • MCP's restore with clean into a database named y was confirmed
    with a tick instead of the typed name: the name to type was inferred
    from the answer that accepts the question. It now comes from the plan.
  • MCP's apply_patches confirmation shows at most 6000 characters of
    SQL; past that it was still confirmed with a tick, so a statement
    after the cut ran unseen. A cut confirmation now takes the
    environment's name typed.
  • The editor ran a script with writes and its own COMMIT (or
    PREPARE TRANSACTION) inside pgman's auto_tx transaction, so its
    writes were committed at its COMMIT and the rollback pgman offered
    after undid nothing. Such a script is now refused while auto_tx is
    on, saying why.
  • A read-only session could be made writable by set_config with a
    column for the setting's name
    (SELECT set_config(n, 'off', false) FROM (SELECT 'default_transaction_read_only' AS n) s): a bare word was read as the
    name itself. Any first argument but a string literal not naming a
    read-only setting now counts as lifting read-only.
    SET default_transaction_read_only = 'on' is no longer refused as one.
  • MCP's restore took any masked archive in the working directory
    without asking the journal, so an agent could build an archive of its
    own, whose schema pg_restore would run, and have it restored (without
    a question, under restore_confirm = "clean_only"). A raw .dump was
    known by its path, so one overwritten in place passed too. restore
    now takes only a dump this machine's pgman took, known by its
    content: an archive by its id and manifest fingerprint, a .dump by
    the sha256 the journal now records for each single-file dump. A dump
    taken before this release has no sha256 and is refused over MCP;
    restore it at a terminal or dump it again. pg_restore also reads a
    private copy taken and checked before the operator is asked, so a
    file changed while they read the question changes nothing; an
    archive's schema is always restored from such a copy, and each of its
    data files is checked against the manifest as it is loaded.
  • MCP's query no longer lets a safety.toml guard set to allow reach
    the agent: such a guard counts as confirm there, which nobody can
    answer. With ddl = "allow" or other = "allow" for a database, an
    agent could run VACUUM FULL, CLUSTER, REINDEX, CHECKPOINT or
    COPY … TO PROGRAM, which Postgres runs even in a read-only session.
    The default guards were never affected.
  • Masked dumps kept three kinds of personal column raw. A text column
    named email_id, emailid or mobile_id was taken for a key; it is
    now masked as an email or phone number. born_at was kept as a
    timestamp; it now keeps only the year, as date_of_birth does. name
    on a holder's table (passengers, payees, beneficiaries) is now
    masked as a person's name. Masked copies of a database with such
    columns should be taken again.
  • Masked dumps judge a column whose name says nothing by its domain's
    name too, so contact email_address is masked as an email instead of
    kept. Masked copies of a database with such columns should be taken
    again.