Compare commits
2 Commits
master
...
bug/sc-161
Author | SHA1 | Date | |
---|---|---|---|
|
5da3490aa3 | ||
|
592ef90abc |
3
Makefile
3
Makefile
@ -1,7 +1,7 @@
|
||||
# cartodb/Makefile
|
||||
|
||||
EXTENSION = cartodb
|
||||
EXTVERSION = 0.37.1
|
||||
EXTVERSION = 0.37.2
|
||||
|
||||
SED = sed
|
||||
AWK = awk
|
||||
@ -110,6 +110,7 @@ UPGRADABLE = \
|
||||
0.35.0 \
|
||||
0.36.0 \
|
||||
0.37.0 \
|
||||
0.37.1 \
|
||||
$(EXTVERSION)dev \
|
||||
$(EXTVERSION)next \
|
||||
$(END)
|
||||
|
3
NEWS.md
3
NEWS.md
@ -1,3 +1,6 @@
|
||||
0.37.2 (2021-09-27)
|
||||
* Change `CDB_TableMetadata_Trigger` to handle a race condition due to concurrent inserts.
|
||||
|
||||
0.37.1 (2020-12-02)
|
||||
* Change `__CDB_RegenerateTable_Get_Commands` to use the caller timeout or '1min' if not set.
|
||||
|
||||
|
@ -42,16 +42,26 @@ BEGIN
|
||||
SELECT oid FROM pg_class WHERE oid = tabname
|
||||
);
|
||||
|
||||
WITH nv as (
|
||||
SELECT TG_RELID as tabname, now() as t
|
||||
), updated as (
|
||||
UPDATE @extschema@.CDB_TableMetadata x SET updated_at = nv.t
|
||||
FROM nv WHERE x.tabname = nv.tabname
|
||||
RETURNING x.tabname
|
||||
)
|
||||
INSERT INTO @extschema@.CDB_TableMetadata SELECT nv.*
|
||||
FROM nv LEFT JOIN updated USING(tabname)
|
||||
WHERE updated.tabname IS NULL;
|
||||
BEGIN
|
||||
WITH nv as (
|
||||
SELECT TG_RELID as tabname, now() as t
|
||||
), updated as (
|
||||
UPDATE @extschema@.CDB_TableMetadata x SET updated_at = nv.t
|
||||
FROM nv WHERE x.tabname = nv.tabname
|
||||
RETURNING x.tabname
|
||||
)
|
||||
INSERT INTO @extschema@.CDB_TableMetadata SELECT nv.*
|
||||
FROM nv LEFT JOIN updated USING(tabname)
|
||||
WHERE updated.tabname IS NULL;
|
||||
EXCEPTION
|
||||
-- Managing race condition due to concurrent inserts
|
||||
WHEN UNIQUE_VIOLATION THEN
|
||||
WITH nv as (
|
||||
SELECT TG_RELID as tabname, now() as t
|
||||
)
|
||||
UPDATE @extschema@.CDB_TableMetadata x SET updated_at = nv.t
|
||||
FROM nv WHERE x.tabname = nv.tabname;
|
||||
END;
|
||||
|
||||
RETURN NULL;
|
||||
END;
|
||||
|
Loading…
Reference in New Issue
Block a user