From ff08384a25201bba44da08c7e3af3fe24151f775 Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Mon, 11 May 2026 13:02:51 +0200 Subject: [PATCH 1/3] fix: mark generateIdentifierFromStoredProcedure functions as VOLATILE --- doc/sphinx-guides/source/_static/util/createsequence.sql | 2 +- .../source/_static/util/identifier_from_timestamp.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sphinx-guides/source/_static/util/createsequence.sql b/doc/sphinx-guides/source/_static/util/createsequence.sql index 7ac1968de2c..ff24789afc0 100644 --- a/doc/sphinx-guides/source/_static/util/createsequence.sql +++ b/doc/sphinx-guides/source/_static/util/createsequence.sql @@ -30,4 +30,4 @@ BEGIN identifier := nextval('datasetidentifier_seq')::varchar; RETURN identifier; END; -$$ LANGUAGE plpgsql IMMUTABLE; +$$ LANGUAGE plpgsql VOLATILE; diff --git a/doc/sphinx-guides/source/_static/util/identifier_from_timestamp.sql b/doc/sphinx-guides/source/_static/util/identifier_from_timestamp.sql index a755b5ecd4a..4324cc0e348 100644 --- a/doc/sphinx-guides/source/_static/util/identifier_from_timestamp.sql +++ b/doc/sphinx-guides/source/_static/util/identifier_from_timestamp.sql @@ -43,4 +43,4 @@ BEGIN identifier := base36_encode(curr_time_msec); RETURN identifier; END; -$$ LANGUAGE plpgsql IMMUTABLE; +$$ LANGUAGE plpgsql VOLATILE; From 58bee431ae4b2692c87d33c078e621c409b3869b Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Mon, 11 May 2026 13:32:14 +0200 Subject: [PATCH 2/3] fix: add Flyway migration to mark generateIdentifierFromStoredProcedure functions as VOLATILE --- src/main/resources/db/migration/V6.10.1.2.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/resources/db/migration/V6.10.1.2.sql diff --git a/src/main/resources/db/migration/V6.10.1.2.sql b/src/main/resources/db/migration/V6.10.1.2.sql new file mode 100644 index 00000000000..5e8e0aeea95 --- /dev/null +++ b/src/main/resources/db/migration/V6.10.1.2.sql @@ -0,0 +1,14 @@ +-- This migration ensures that the function used for identifier generation +-- is marked as VOLATILE to prevent caching issues that could lead to +-- infinite loops in the application code. + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM pg_proc + WHERE proname = 'generateidentifierfromstoredprocedure' + ) THEN + ALTER FUNCTION generateIdentifierFromStoredProcedure() VOLATILE; + END IF; +END $$; From 3e344d524e033bf20761e023c6bc84ba625dcdb4 Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Mon, 11 May 2026 13:36:33 +0200 Subject: [PATCH 3/3] docs: add release note for #12391 --- doc/release-notes/12391-fix-pid-generator-volatility.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/release-notes/12391-fix-pid-generator-volatility.md diff --git a/doc/release-notes/12391-fix-pid-generator-volatility.md b/doc/release-notes/12391-fix-pid-generator-volatility.md new file mode 100644 index 00000000000..32469ea9459 --- /dev/null +++ b/doc/release-notes/12391-fix-pid-generator-volatility.md @@ -0,0 +1,5 @@ +Fixed an issue where dataset creation could become stuck in an infinite loop when using a custom stored procedure for PID generation. + +The root cause was the stored procedure being marked as `IMMUTABLE` in PostgreSQL, which allowed the database or persistence layer to cache its result. + +A Flyway migration has been added to automatically set the volatility of `generateIdentifierFromStoredProcedure()` to `VOLATILE` instead. \ No newline at end of file