Re: [fixed] Trigger test

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dmitrii Bondar <d.bondar@postgrespro.ru>
Cc: Paul Jungwirth <pj@illuminatedcomputing.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Lilian <ontowhee@gmail.com>
Date: 2025-04-05T19:54:18Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix some issues in contrib/spi/refint.c.

  2. I send you a attach of my modified refint.c that

Dmitrii Bondar <d.bondar@postgrespro.ru> writes:
> On 04/04/2025 01:11, Tom Lane wrote:
>> So that's a long laundry list and we haven't even dug hard.
>> Is it worth it?  If you feel like doing the legwork then
>> I'm willing to support the project, but I really wonder if
>> we shouldn't cut our losses and just remove the module.

> You wrote a note that I decided to omit. As I mentioned, the patch does 
> not even fix the cascade update problem—there are still broken 
> cases—because it seems impossible to address it in a gentle way (the 
> code was patched 20 years ago; it's truly legacy).

I'm not terribly concerned about whether these triggers have perfect
foreign-key semantics, since no one (in their right mind) would use
them as foreign-key enforcement anyway.  What they're good for
is as examples of writing checks and updates in C-coded triggers.
As such, questions like "are identifiers and data values quoted
appropriately" seem far more urgent than whether cascade update
works per spec.  Even just using a StringInfo rather than a fixed-size
char[] variable to build the query in would be an improvement.

> I considered removing it entirely, but that seemed too drastic a 
> solution (and, at the very least, I don't have enough expertise to make 
> that decision).

I'm not that thrilled with giving up on refint.c either.  But in its
current state, it's a pretty lousy example.  Are we willing to put
enough effort into making it a more useful code example?

			regards, tom lane