Skip to content

Postern 0.2.0

Choose a tag to compare

@github-actions github-actions released this 17 Sep 20:26
· 50 commits to main since this release

Postern 0.2.0

  • The Zed extension takes the grammar's 0.1.1 release, in which a single quote is an ordinary
    character in pg_hba.conf and pg_ident.conf, as it is to the server. The other packages
    follow the grammar's main branch and have it already.
  • A line of pg_hba.conf or pg_ident.conf that ends with a backslash goes on with the next
    one, the way the server has read it since 14, joined as it is, so the continuation works inside
    a quoted token or a comment and an empty line ends the record. The record carries the number
    of the line it starts on, as pg_hba_file_rules reports it, and a problem on a later line is
    marked there. A target older than 14 reads every line on its own.
  • A pg_hba.conf rule is checked as a whole the way hba.c checks it once its options are read:
    gssapi on a local socket, peer anywhere else and cert without hostssl are errors, ldap must
    choose between a simple bind and search+bind and take one of ldapsearchattribute and
    ldapsearchfilter, radius needs its servers and secrets with lists that fit, and oauth needs an
    issuer and a scope and no map next to delegate_ident_mapping, each in the server's words for
    the target version. A comma in an option field starts another option, as it does for the
    server, so a list meant as one value is quoted. ident on a local socket gets a hint that the
    server reads it as peer.
  • A pg_hba.conf rule is read field by field the way hba.c reads it, so a line that ends too
    soon, a list where one value belongs, a host name with a CIDR mask, a mask that does not fit
    its address and a method the target version does not know are the server's errors in its
    words, and a token meant as an address that the server would look up as a host name gets a
    warning. scram-sha-256-plus, a SASL mechanism rather than a method, is no longer taken for
    one. The include directives and regular expressions in pg_hba.conf and pg_ident.conf are
    checked against the version, which took them in 16, oauth against 18, and includes are not
    followed for an older target. Completion offers the methods the version has.
  • Postern follows include, include_if_exists and include_dir the way the server does,
    relative to the file that names them, in C locale order for a directory, and reads
    postgresql.auto.conf from the data directory last, so a setting a later file overrides gets
    a hint on the line that loses naming the file and line that win, and an include the server
    could not open gets the error pg_file_settings would show. The hint for a setting repeated in
    one file moved to the line that loses too. Hover says where the value that counts is set, go to
    definition goes there, and an include line links to its file. pg_hba.conf and pg_ident.conf
    trees work the same way, so a rule an included file shadows and a map an included file defines
    are seen. A file with another name is known by the root that includes it, postern check
    walks the tree of a root it is given, and a live check reports a line pg_file_settings left
    unapplied for a later entry. The resolver is compared with pg_file_settings on every
    supported version in CI.
  • A file with another name is checked as what the editor calls it: postgresql-conf, pg-hba or
    pg-ident. The editor packages claim postgresql.base.conf, which Patroni keeps the original
    file as, and a .conf file under a conf.d directory below a postgresql directory, which is
    how Debian lays out an include_dir; Neovim, Emacs and Zed also take a file whose first line is
    a # postern: comment. The Zed extension sends postgresql-conf as the language id.
  • A check on pg_hba.conf reads the pg_ident.conf next to it, and the other way round: from
    the editor while the file is open, from the disk otherwise. A map no longer shows as missing
    or unused because of which files happen to be open, and when one of the two changes the other
    is checked again. Without the other file there to look at, map names are not checked at all.
  • Every option on a pg_hba.conf rule is checked against the connection type, the method and
    the target PostgreSQL version the way hba.c checks it, with the messages pg_hba_file_rules
    reports, and the problem is marked on the option. map= on a peer, cert, gss, sspi or oauth
    rule is now looked up in pg_ident.conf, and the map it names no longer shows as unused
    there. Completion offers the options the rule's method takes.
  • The Zed extension is postgresql-conf, the id Zed's guidelines give a language extension, carries
    its own license and references the grammar's 0.1.0 release, ready for the extension registry.
  • An Emacs package in editors/emacs: a tree-sitter major mode for the four files with Imenu and
    navigation, registered with Eglot for the server.
  • The Zed extension asks the release for the asset names it actually has when it downloads the
    server.