0
votes

I have one question about the function flow in PostgreSQL. I used function to insert/update in table A and the function return integer value 1-> insert transaction, 0->update transaction. My question is if I add AFTER trigger in table A to update the new value to table B, when the return function will be delivered? First or second scenario?

First scenario: Call function -> update table A -> return function value -> call trigger -> update table B

Second scenario: Call function -> update table A -> call trigger -> update table B -> return function value?

Thanks in advance.

1
Question isn't very clear... - Denis de Bernardy
I want to know if I call function to update table A, and where table A have trigger to update table B. When the function will return the integer value? First or second scenario? Thanks - user430926
I desagre with @Denis the question has all elements to understand the problem. - Jorge Campos
@JorgeCampos: it does now. It didn't a half hour ago. :-) - Denis de Bernardy

1 Answers

1
votes

The second scenario. Updating B will be part of updating A, and your function will wait until that completes before returning.