The SQL standard defines a set of rules so that database systems can be interchangeable,
but there are small singularities in the wild. In this regard, the hierarchyid data type
provided by SQL Server is a striking example. If you are switching to PostgreSQL, two
solutions are available to you.
A first and simpler solution consists in linking each node to its parent using a new
parentid column and applying a foreign key constraint. Another, more complete approach
consists in using the ltree extension. This article deals with the latter case.
The PG Day France took place on June 11th and 12th in Lille, my hometown.
It is the event of the French PostgreSQL community that settles in a different city each year.
The opportunity was too good for me and I met many people from all over France and its surroundings,
to discuss PostgreSQL during two days of workshops and conferences.
For this edition, I had the pleasure of speaking and sharing my experience on the animation of
the local Meetup group that I took over four years ago. In this article, I want to write down the
main points discussed during this presentation, while waiting for the video of the conference to be
posted online.
During the last PGSession organized by Dalibo, I wrote and led a workshop
(french) on the migration to PostgreSQL using Foreign Data Wrappers, or FDW.
This was an opportunity to present to the general public the db_migrator
extension for which I wrote an article on this blog.
While working on this workshop, we noticed that copying data with the
db_migrator extension is not perfectly supported. Indeed, although there is a
low-level function to distribute the transfer table by table over several
processes, many situations will require writing a large number of SQL queries to
get out of trouble. Over the following months, I worked on the design of an
assistant written in PL/pgSQL whose purpose is to simplify the generation
of these queries.
In computer science, a migration project involves changing one or more technical
components without impacting any application behaviors. In the realm of
databases (and the profession I practice), it will involve choosing a new system
(such as PostgreSQL) to replace another (such as Oracle or Microsoft SQL
Server).
In a previous article (French), I described exhaustive steps to perform a
complete migration using Foreign Data Wrappers technology. However, the critical
data transfer step described there does not suit all situations. Let’s explore
together the alternatives that cover a large portion of the needs.
Over the past months, I have spent several weeks contributing to the
db_migrator extension. Written solely in PL/pgSQL, it enables the migration of
schemas and data from a database system to PostgreSQL using the external data I
had presented few years ago.
In this post, I present the functionality of the tool, its philosophy, and
the reason I found for its existence, even though it joins the ecosystem of
well-established open-source projects in the migration landscape. How does it
compare to Ora2Pg or pgloader in terms of value and capabilities?