Jakub Ouhrabka <jouh8664@ss1000.ms.mff.cuni.cz> writes:
> i'm getting strange results when executing the code below. i would expect
> that li_count in function foo and the select after calling this function
> should return same values.
An AFTER trigger runs at the end of the transaction, so it hasn't fired
yet at the time your function foo looks at the table. Perhaps you want
a BEFORE trigger instead.
regards, tom lane