Validating JSON data type column in PostgreSQL

In this post, we see how to validate the JSON/JSONB data type column in PostgreSQL 10. Most of the basic JSON/JSONB validation has been taken care in core of PostgreSQL itself, however you may have a requirement to validate the JSON format elements data types while inserting. For such requirements, you need to write a Pl/PgSQL function to validate the JSON data when accepting it in JSON/JSONB column in a CHECK constraint.

Continue reading →

Configure Streaming Replication in PostgreSQL 10

In this post, we configure Streaming Replication between One Master and 2 Standbys(Standby 1/Standby 2). Replication will be 1:1 but not cascading. Below are my setup details OS - RedHat Enterprise Linux 7.x Master IP - 172.31.34.34 Standby 1 IP - 172.31.32.122 Standby 2 IP - 172.31.41.249 Installation Today www.postgresql.org distributes binaries in different formats contributed by many companies. For this setup, am going to use YUM method of installation as shown in the main website link here.

Continue reading →

CREATE LANGUAGE plpython3u - PostgreSQL 9.6

This is one of the quickest blog am publishing :). I am publishing from my terminal as is of my testing to create language plpython3u. Using trusted or untrusted distributions of python we can create plpython3u language in PostgreSQL. In my testing, am trying with SCL distribution(am not recommending, I tried for testing) of python3.3 to create language plpython3u. Let’s begin creating language on a binary version of PostgreSQL 9.6 installation without any tweaking.

Continue reading →

How to rotate PgBouncer logs in Linux/Windows ?

Before doing a deep dive into the subject, a short outline about PgBouncer, its a lightweight connection pooler for PostgreSQL that dramatically reduces the processing time and resources for maintaining a large number of client connections to one or more databases. Typically used to increase the number of user connections that can be handled in a high performance environment. For more details on Installing/Configuring PgBouncer refer to the documentation here.

Continue reading →