Skip to content

Open source Team

Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.

721 posts since September 2011

What is the difference between session_user and current_user in PostgreSQL?

When you want to know the currently connected user in PostgreSQL for your session there are two system information functions which seem to do the same thing. There is “session_user” and there is “current_user”. So what is the difference between those or is there no difference at all? Looking at my users in PostgreSQL all I have right now is… 

SELinux – how to change the security context

We all know the pain of an “enforced” SELinux that is overly suspicious and blocks our applications. Typically, when issues arise, we tend to search for solutions everywhere except within the /var/log/audit/audit.log or /var/log/audit directories. Within the audit logs, we might discover that SELinux is actively preventing our applications from running. Some people opt to set SELinux to “Permissive” mode… 

PostgreSQL 17: login event triggers

This is a feature I am sure a lot of people have waited for and finally it was committed for PostgreSQL 17. Back in my Oracle days it was quite common to have a trigger firing once a user logged into the database. This is e.g. useful to setup some logging or deny logins based on the day of the… 

PostgreSQL: Managing multiple “users” with roles

Having multiple users but don’t want them to use the same account?In such a case you can use a role to group your users together.And even better you can set default privileges for that role before creating anything important in your database to have your access privileges setup right from the get go!In PostgreSQL terms the only difference between a… 

PostgreSQL 17: Support for AT LOCAL

When it comes to conversions between time zones in PostgreSQL, there is already much you can do today. What PostgreSQL up to version 16 does not support, is the conversion to the local session’s time zone with ‘AT LOCAL’. Starting with PostgreSQL 17 this will be possible, as this functionality was just committed. Let’s have a look at how you… 

How the name of the initial superuser is chosen in PostgreSQL

When working with a PostgreSQL instance, most of the time the initial superuser is called “postgres”. One might think this is always the case, and this user is there by default. But the name for that user is chosen by some rules and in this post we’ll look at this. In almost all the installations we’ve seen out there, PostgreSQL… 

No more snapshot too old in PostgreSQL 17

Currently PostgreSQL has a feature which is called snapshot too old. While each release of PostgreSQL comes with a bunch of new features, sometimes features also get removed. Starting with PostgreSQL 17 there will be most likely no more “snapshot too old”. Before looking at why that got removed lets first have a look at what it is. The main… 

“create user”, “create role”, what should be used in PostgreSQL?

Recently we’ve seen a video on YouTube which recommends not to use the “create user” command in PostgreSQL and instead always use the “create role” command. It was also mentioned that “create group” should not be used as well. We’ve been a bit surprised by this and this is the reason for this post. While we never use the “create… 

PostgreSQL 17: Allow “\watch” to stop based on the number of rows returned

psql already is really powerful but still it gets more features with almost every release of PostgreSQL. One example is the “\watch” meta command. This command was introduced in PostgreSQL 9.3 and hasn’t changed much since then. PostgreSQL 17, probably next year, will come with an extended “\watch” meta command. Before we look at what was added lets briefly look… 

PostgreSQL 17: pg_wait_events

As development of PostgreSQL 17 already started there are already some commits which bring in new functionality. One of them introduces a new catalog view called “pg_wait_events”. As the same implies, this view lists the known wait events for PostgreSQL. Many of those wait events came in over time since the “wait_event_type” and “wait_event” columns have been to PostgreSQL 9.6.…