Skip to content

Commit

Permalink
Allow read-only replicas work even when the context extension is enab…
Browse files Browse the repository at this point in the history
…led (#298)
  • Loading branch information
drnextgis authored Aug 26, 2024
1 parent 2f00dbe commit b73d570
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pgstac/sql/004_search.sql
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,14 @@ BEGIN
RETURN sw;
END IF;

-- Get any stats that we have. If there is a lock where another process is
-- updating the stats, wait so that we don't end up calculating a bunch of times.
SELECT * INTO sw FROM search_wheres WHERE md5(_where)=inwhere_hash FOR UPDATE;
-- Get any stats that we have.
IF NOT ro THEN
-- If there is a lock where another process is
-- updating the stats, wait so that we don't end up calculating a bunch of times.
SELECT * INTO sw FROM search_wheres WHERE md5(_where)=inwhere_hash FOR UPDATE;
ELSE
SELECT * INTO sw FROM search_wheres WHERE md5(_where)=inwhere_hash;
END IF;

-- If there is a cached row, figure out if we need to update
IF
Expand Down

0 comments on commit b73d570

Please sign in to comment.