Foto%20quadrada%20per%20silvrback_large

Josep

Change SERIAL to IDENTITY in PostgreSQL

PostgreSQL 10 implements SQL standard's IDENTITY

In SQL Server is quite common to use IDENTITYs for non-natural primary keys. In PostgreSQL, until version 10, only SERIALs could be used for the same purpose. But that has changed.

Why INDENTITY and not SERIAL and SEQUENCES?

SERIAL is a friendly way to set a SEQUENCE, but at the end, it's a SEQUENCE: an object that . . .

Read More

Posted in: postgresql

February 27, 2018

DEFERRED CONSTRAINTS in PostgreSQL

How to check consistency at the end of a transaction

Introduction

DEFERRED CONSTRAINTS are useful when you know that in a transaction you'll have inconsistent data for a while, like foreign keys that don't match, but you know that at the end of a transaction it will be consistent.

It was a nice PostgreSQL surprise to discover DEFERRED CONSTRAINTS, because it's not . . .

Read More

Posted in: postgresql

December 19, 2017

PostgreSQL "Could not resolve client IP address to a host name" error

Using hostnames in pg_hba.conf

Since PostgreSQL 9.1 it's possible to use host names in pg_hba.conf.

I'm using it in a server and I got this error from a Java's client application trying to connect to it:

Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "192.168.1.2", user "my_user", . . .

Read More

Posted in: postgresql

June 03, 2016

SQL Server vs PostgreSQL: fighting for resources in the same server

Introduction

Notice: This is not the typical performance’s comparative between SQL Server and PostgreSQL. I only test their performance’s affectation when they run in the same server, that I would never do.

We were asked: “Is it possible to run SQL Server and a PostgreSQL in the same server?”

Obviously, . . .

Read More

April 20, 2016

Archive