BUG #14450: inconsistent results on async slave
The following bug has been logged on the website:
Bug reference: 14450
Logged by: Rikard Pavelic
Email address: rikard@ngs.hr
PostgreSQL version: 9.3.14
Operating system: Linux
Description:
Before applying new version of the function to the database I wanted to
check if results of the function were the same
So we ran a query like this:
select a.id, original_fun(a.id), new_fun(a.id)
from table a
where coalesce(original_fun(a.id), MIN_DATE) != coalesce(new_fun(a.id),
MIN_DATE)
on all our async slave instances.
Strangely for small number of rows (6 out of 500k) this query returned
different results.
After running:
select original_fun(diff_id), new_fun(diff_id);
for one of those ids, the function returned the same result.
Is this expected behavior?
original_fun = plpgsql (volatile - should be stable)
new_fun = sql
What is even more strange, is that different results were like this:
id1, X1, null
id2, null, X2
id3, X3, null
id4, X4, null
id5, X5, null
id6, X6, null
data is only inserted and X_ represents min date of sum subset of data in
other tables.
Regards,
Rikard
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
rikard@ngs.hr writes:
Is this expected behavior?
You haven't provided nearly enough information to let anyone diagnose
this with certainty; but if the data is changing under you, then replacing
a volatile function with a stable one could certainly cause different
results, because the data visibility rules would be different. See
https://www.postgresql.org/docs/9.3/static/xfunc-volatility.html
particularly the bit about volatile functions using a new snapshot
on each call.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs