Re: Handling OID Changes in Regression Tests for C Extensions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Lakshmi Narayana Velayudam <dev(dot)narayana(dot)v(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Handling OID Changes in Regression Tests for C Extensions
Date: 2025-06-14 15:20:31
Message-ID: 1629026.1749914431@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(at)vondra(dot)me> writes:
> On 6/14/25 11:43, Lakshmi Narayana Velayudam wrote:
>> I am facing a challenge related to OID changes in regression tests while
>> working on a PostgreSQL C extension. Whenever I add or remove a function
>> to the SQL file, it alters OIDs and leads to cascading modifications in
>> multiple test files. This creates a significant overhead in maintaining
>> the regression tests.

> The OIDs for user-defined objects (e.g. those from extensions) are not
> stable, and this will not change. The only way is to prevent the test
> output, e.g. by not including OIDs in the results, and eliminating all
> other types of non-determinism - eg. by enforcing ordering, etc.

You could also make your tests print database object OIDs in
symbolic form, e.g. cast function OIDs to regprocedure, use
pg_describe_object(), etc. Then it doesn't matter if the
underlying numbers change.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-06-14 15:37:05 Re: Replication slot is not able to sync up
Previous Message David E. Wheeler 2025-06-14 15:08:07 Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part