mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
This makes sure we don't confuse user-controlled functions with PG's builtin functions. ## Problem See https://github.com/neondatabase/cloud/issues/31628
7 lines
396 B
SQL
7 lines
396 B
SQL
-- We use a GREATEST call here because this calculation can be negative. The
|
|
-- calculation is not atomic, meaning after we've gotten the receive LSN, the
|
|
-- replay LSN may have advanced past the receive LSN we are using for the
|
|
-- calculation.
|
|
|
|
SELECT GREATEST(0, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_receive_lsn(), pg_catalog.pg_last_wal_replay_lsn())) AS replication_delay_bytes;
|