From: dvarrazzo (@dvarrazzo) <noreply+dvarrazzo@github.com>
To: psycopg/psycopg <noreply+psycopg-psycopg@github.com>
Subject: Re: [psycopg/psycopg] PR #1322: Add pg_lsn adapter
Date: Wed, 18 Nov 2026 12:56:36 +0000
Message-ID: <gh-psycopg-psycopg-1322-rc4614239216@github.com> (raw)
In-Reply-To: <gh-psycopg-psycopg-1322-rc3398133626@github.com>
References: <gh-psycopg-psycopg-1322@github.com>
<gh-psycopg-psycopg-1322-rc3398133626@github.com>
(on psycopg/psycopg/types/catalog.py:57)
You can add an integer to an LSN and you get a new LSN shifted of some amount. Of course you can add a negative number to shift it backwards. but subtracting two LSNs gives a number. And you cannot add two LSN, because the result depends on the origin and it's meaningless on itself.
This is the same model of the timestamps: you can subtract two timestamps and obtain an interval. You can add a timestamp to an interval to obtain a new timestamp. But you cannot add two timestamps because the result would depend on the epoch chosen and it's generally meaningless.
In general, it is the set of operation on what is called an Euclidean Space.