Question Details

No question body available.

Tags

postgresql polardb

Answers (3)

February 26, 2026 Score: 1 Rep: 258,519 Quality: Low Completeness: 30%

You have to avoid the endless loop. It seems like the function syncproductfrom_summary() is involved. Review your logic.

February 26, 2026 Score: 0 Rep: 97,926 Quality: Low Completeness: 30%

Maybe this article has some approaches that work for you?

www.cybertec-postgresql.com: Dealing with trigger recursion in PostgreSQL

February 26, 2026 Score: 0 Rep: 30,507 Quality: Low Completeness: 90%
  1. Is there a way to detect if we're already inside a trigger execution?

pgtriggerdepth()

  1. Should I use a flag or session variable to control trigger execution?

No, at least not this aspect of it.

It would help if you attached the definitions of triggers you create on all tables involved. It looks like you have triggers on both product_summary and products, which keep modifying and firing each other.

Take a look at pgaudit