PostgreSQL

PostgreSQL

All Your GUCs in a Row: server_version and server_version_num

server_version and server_version_num are one fact in two formats: which PostgreSQL this is, as a string for people and as an integer for programs. You cannot set either. Nearly all the trouble they cause comes from handing a program the one meant for people, or from forgetting what “this” means: the postmaster that is running right now, whatever the package

All Your GUCs in a Row: server_encoding

Erratum: the client_encoding post said that SQL_ASCII “disables encoding validation entirely,” and described setting client_encoding = 'UTF8' on an SQL_ASCII server as telling PostgreSQL “trust me, the bytes are UTF-8.” Neither is right. A session that declares a client encoding such as UTF8 has everything it sends and receives checked against it; what SQL_ASCII turns off is conversion. Details below.

All Your GUCs in a Row: serializable_buffers

Erratum: the max_pred_locks_per_transaction post said the predicate lock tables have “no spillover and no summarization.” The second half is wrong. When PostgreSQL runs out of records for serializable transactions, it folds the SIREAD locks of the oldest committed ones into a single placeholder transaction, collapsing duplicates as it goes; that mechanism is the subject of this post. What the earlier

All Your GUCs in a Row: send_abort_for_crash and send_abort_for_kill

send_abort_for_crash and send_abort_for_kill are the only two parameters in PostgreSQL whose job is to make a crash worse, on purpose, so that it leaves evidence behind.

The machinery they modify is the one I walked through in restart_after_crash. When a child process is killed by a signal, or exits with any status other than 0 or 1, the

All Your GUCs in a Row: segment_size

segment_size reports how many blocks PostgreSQL will put in one file before it starts the next. Since PostgreSQL keeps no authoritative record of how long a table is, it is also how the server decides where one ends.

It is a preset, like block_size: context internal, fixed when the binary was compiled, and not settable by any

All Your GUCs in a Row: search_path

Erratum: the check_function_bodies post said that SQL-language functions are always parsed and bound when they are created, whatever that parameter is set to. That is true only of the BEGIN ATOMIC form. A SQL function whose body is a string is checked at creation only when check_function_bodies is on, and its names are resolved when it is called, which is

Stop Using AI to Report PostgreSQL Bugs

Lately, the PostgreSQL’s bug-report mailing list has been receiving a large number of AI-generated bug reports. Often, these come in flurries of 10-15 bugs, each from the same email address.

These bug reports are of, shall we say, highly variable quality.

Just looking through a few of the recent flurries, they include:

  • One which was clearly

All Your GUCs in a Row: scram_iterations

Back, after recovery from PGConf.EU!

scram_iterations is not really a server setting. It is the default for a property of each password, written into the password at the moment it is set, and the server itself reads the number on only two later occasions: when someone sets another password, and when someone tries to log in as a role

All Your GUCs in a Row: row_security

row_security = off does not turn row-level security off. Nothing a plain session can set could turn row-level security off, for the obvious reason, and row_security is a plain-session setting: boolean, default on, context user, settable by any role in any session, and per role or per database with ALTER ROLE ... SET or ALTER DATABASE ... SET

All Your GUCs in a Row: restrict_nonsystem_relation_kind

restrict_nonsystem_relation_kind is a security patch that happens to be spelled like a configuration parameter. You will almost never set it. pg_dump sets it, on its own connection, as the last thing it does before opening its transaction, and the entire reason the parameter exists is so that it can. The manual gives it three sentences and never says the word