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.


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

Read More

Posted in: postgresql

February 27, 2018

Export data from Oracle to MongoDB in Python

This post can be found in a Jupyter Notebook in my Github.

This could be a good script as a starting point to export data from Oracle to MongoDB. It can be modified easily to add some row transformations (like combining columns) or other things.

Tested with:

  • pymongo version: 3.4.0
  • cx_Oracle version: 6.0.2

Useful URLs:

Read More

February 09, 2018

YAML in powershell

powershell doesn't have native support for yaml. Solution: PSYAML and powershell-yaml

YAML is not supported by default in powershell like JSON and XML, although some people are already asking for it in github and Windows user voice (give your voice, too!). YAML is more comfortable for human reading than JSON.

Currently there're two maintained modules to work with YAML:

  • PSYaml from Phil Factor. More info in this post. . . .

Read More

Posted in: powershell

December 27, 2017


How to check consistency at the end of a transaction


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 present in many . . .

Read More

Posted in: postgresql

December 19, 2017

SQL Server trace flags

Changing normal SQL Server's behavior


Microsoft defines the trace flags as:

Trace flags are used to temporarily set specific server characteristics or to switch off a particular behavior.

The purpose of trace flags is to change a SQL Server default behavior. The context they apply to can be global, session or query and it depends on the nature of the flag. For . . .

Read More

Posted in: sqlserver

March 03, 2017

List all Ole DB Providers in Powershell

In Microsoft documentation for OleDbEnumerator.GetRootEnumerator() method
there's a C# example how to list all Ole DB Providers. I've just rewritten it in Powershell, creating a function that returns a list of providers, so it's easier to work with and can be filtered.
It's useful to check which providers are installed in a . . .

Read More

Posted in: oledbpowershell

June 21, 2016

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 "", user "my_user", database . . .

Read More

Posted in: postgresql

June 03, 2016