PostgreSQL

Reproducing a batch insert for Bacula on PostgreSQL

This work from August 2022 was interesting at the time. My database server gets slow from time to time. It seems to happen repeatedly. I’m not sure why, but inserting large numbers of rows takes a very long time. This is a typical use-case for Bacula when recording what was backed up. I started with this, the duplication of the batch table created when Bacula is storing attribute for later insertion into the […]

Reproducing a batch insert for Bacula on PostgreSQL Read More »

Loading up an old copy of a PostgreSQL database, zfs snapshots, and sanoid snapshot management

Sometimes you want to go back to a known good state. And you want to do it quickly, without waiting around. In my case, that’s going to be a zfs snapshot. Today I am preparing to test some code changes so that FreshPorts properly creates a new category. See these recent blog posts for details: Welcome to the new category: filesystems Fixing the category creation code In this post: FreeBSD 14.1-RELEASE-p5 postgresql16-server-16.4 dbclone

Loading up an old copy of a PostgreSQL database, zfs snapshots, and sanoid snapshot management Read More »

Moving local settings for pg_hba.conf and postgresql.conf out of PGDATA

One of the configuration aspects of FreeBSD I have long liked is the concept of default values which are overridden by the user. For example, /etc/defaults/rc.conf (see The /etc directory). The default values in this file can be overridden by the user with their preferred values in /etc/rc.conf (or /etc/rc.conf.local, and other locations if you so choose (search for rc_conf_files)). With that approach in mind, I wanted to do the same thing with

Moving local settings for pg_hba.conf and postgresql.conf out of PGDATA Read More »

Figuring out the upgrade path for AWS RDS from PostgreSQL 12.14 to PostgreSQL 16.1

These are my notes on figuring out an upgrade path for the FreshPorts PostgreSQL 12.14 database hosted on Amazon RDS. Most of this is based on Upgrading the PostgreSQL DB engine for Amazon RDS The sections of this post relate to the sections found at the above URL. First, I installed the AWS CLI (via py39-awscli, created an Access Key for my AWS login, and ran: Note that on line 4 I did

Figuring out the upgrade path for AWS RDS from PostgreSQL 12.14 to PostgreSQL 16.1 Read More »

Bacula: Moving from 9.x to 13.x and upgrading the PostgreSQL database

I have been using Bacula since 2004. It is my backup solution of choice, not only because it has a PostgreSQL backend, but it is flexible, robust, and reliable. I, on the other hand, have long ignored recent releases. I’m using Bacula 9.6.7 (released on 2021-01-26), roughly 3 years ago. Today, I started the upgrade to 13.0.1 (still not the latest release, but that’s because of a minor compile issue, not yet resolved;

Bacula: Moving from 9.x to 13.x and upgrading the PostgreSQL database Read More »

I figured out why pg_dump was failing with PostgreSQL 15-16

In recent blog post, I outlined a problem I hit with pg_dump. Specifically, pg_dump was picking up and using ~/.pgpass with pg_dump from PostgreSQL 12-14, but with PostgreSQL 15-16, it was failing. In this blog post: FreeBSD 13.2 PostgreSQL server 12 / 16 PostgreSQL client 12-16 Bacula 9.6.7 Today we figured out why: $HOME. $HOME for the script was set to / In PostgreSQL < 15, the code used the database to determine

I figured out why pg_dump was failing with PostgreSQL 15-16 Read More »

While restoring my PostgreSQL database to a new FreeBSD server, I discovered the wrong database server in a configuration file

Lately, I’ve been preparing to move from PostgreSQL 12 to PostgreSQL 16 – my main developement database server at home needs to get updated. The goal: migrate each database from the old host (running PostgreSQL 12) to the new host (running PostgreSQL 16) using pg_dump and pg_restore. Today, I decided to migrate the Bacula database. I ran a pg_dump on pg02 today. Then a pg_restore on pg03. That took about 6 hours I

While restoring my PostgreSQL database to a new FreeBSD server, I discovered the wrong database server in a configuration file Read More »

pg_dump: error: connection to server failed: fe_sendauth: no password supplied

FYI, this problem has been solved and described in I figured out why pg_dump was failing with PostgreSQL 15-16. This morning I encountered this error message: In this post: FreeBSD 13.2 PostgreSQL 12.16 (server – pg02) PostgreSQL 16.1 (client – dbclone) See also While restoring my PostgreSQL database to a new FreeBSD server, I discovered the wrong database server in a configuration file. The backstory: dbclone dumps the bacula database hosted on pg02.

pg_dump: error: connection to server failed: fe_sendauth: no password supplied Read More »

pg_dump: error: query failed: ERROR: permission denied for sequence cache_clearing_files_id_seq

Skip to the end of this post for the lesson part of this blog post. This email arrived in my inbox yesterday at about 10:00 PM: This is the backup script for my database dumps on my server at home. I immediately recognized it as the follow-on from a table I had just added. It was late, I was headed to bed. I forgot about it. Until this morning. This morning This morning,

pg_dump: error: query failed: ERROR: permission denied for sequence cache_clearing_files_id_seq Read More »

PostgreSQL – convert a user to a role

Users and Roles in PostgreSQL are very similar. When I set up the FreshPorts database back in mid-2000, I was using PostgreSQL 7.0.3 (that’s my best guess based on my blog entry). I suspect roles were not available then and were introduced with PostgreSQL 8. I am positive someone will correct me if that’s wrong. I now have a need to convert a user into a role, then add users to that role.

PostgreSQL – convert a user to a role Read More »

Scroll to Top