Migration fails on PostgreSQL 18 due to uuidv7 function #20494

Closed
opened 2026-02-21 20:07:41 -05:00 by yindo · 1 comment
Owner

Originally created by @hyunrealshadow on GitHub (Nov 22, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When running Dify migrations on PostgreSQL 18, the migration 1c9ba48be8e4 (add uuidv7 function in SQL) fails.
The uuidv7 SQL function is incompatible with PG18, causing the migration to error out and preventing subsequent tables from being created.

Steps to reproduce:

Use PostgreSQL 18.

Run alembic upgrade head on a fresh Dify database.

execute uv run flask db upgrade

✔️ Expected Behavior

Migration should either succeed or provide a workaround compatible with PostgreSQL 18.

Actual Behavior

Observe the migration failure at 1c9ba48be8e4.

INFO  [alembic.runtime.migration] Running upgrade 58eb7bdb93fe -> 1c9ba48be8e4, add uuidv7 function in SQL
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.AmbiguousFunction: function name "uuidv7" is not unique
HINT:  Specify the argument list to select the function unambiguously.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/api/.venv/bin/flask", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask/cli.py", line 1131, in main
    cli.main()
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1383, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1850, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1850, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1246, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask/cli.py", line 400, in decorator
    return ctx.invoke(f, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/cli.py", line 154, in upgrade
    _upgrade(directory, revision, sql, tag, x_arg)
  File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 111, in wrapped
    f(*args, **kwargs)
  File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 200, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/command.py", line 483, in upgrade
    script.run_env()
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 545, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
    module = load_module_py(module_id, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/app/api/migrations/env.py", line 110, in <module>
    run_migrations_online()
  File "/app/api/migrations/env.py", line 104, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/runtime/migration.py", line 627, in run_migrations
    step.migration_fn(**kw)
  File "/app/api/migrations/versions/2025_07_02_2332-1c9ba48be8e4_add_uuidv7_function_in_sql.py", line 43, in upgrade
    op.execute(sa.text(r"""
  File "<string>", line 8, in execute
  File "<string>", line 3, in execute
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/ops.py", line 2591, in execute
    return operations.invoke(op)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/base.py", line 441, in invoke
    return fn(self, operation)
           ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/toimpl.py", line 240, in execute_sql
    operations.migration_context.impl.execute(
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/ddl/impl.py", line 253, in execute
    self._exec(sql, execution_options)
  File "/app/api/.venv/lib/python3.12/site-packages/alembic/ddl/impl.py", line 246, in _exec
    return conn.execute(construct, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
    return meth(
           ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.AmbiguousFunction) function name "uuidv7" is not unique
HINT:  Specify the argument list to select the function unambiguously.

[SQL:
/* Main function to generate a uuidv7 value with millisecond precision */
CREATE FUNCTION uuidv7() RETURNS uuid
AS
$$
    -- Replace the first 48 bits of a uuidv4 with the current
    -- number of milliseconds since 1970-01-01 UTC
    -- and set the "ver" field to 7 by setting additional bits
SELECT encode(
               set_bit(
                       set_bit(
                               overlay(uuid_send(gen_random_uuid()) placing
                                       substring(int8send((extract(epoch from clock_timestamp()) * 1000)::bigint) from
                                                 3)
                                       from 1 for 6),
                               52, 1),
                       53, 1), 'hex')::uuid;
$$ LANGUAGE SQL VOLATILE PARALLEL SAFE;

COMMENT ON FUNCTION uuidv7 IS
    'Generate a uuid-v7 value with a 48-bit timestamp (millisecond precision) and 74 bits of randomness';
]
(Background on this error at: https://sqlalche.me/e/20/f405)
Originally created by @hyunrealshadow on GitHub (Nov 22, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When running Dify migrations on PostgreSQL 18, the migration 1c9ba48be8e4 (add uuidv7 function in SQL) fails. The uuidv7 SQL function is incompatible with PG18, causing the migration to error out and preventing subsequent tables from being created. Steps to reproduce: Use PostgreSQL 18. Run alembic upgrade head on a fresh Dify database. execute `uv run flask db upgrade` ### ✔️ Expected Behavior Migration should either succeed or provide a workaround compatible with PostgreSQL 18. ### ❌ Actual Behavior Observe the migration failure at 1c9ba48be8e4. ``` INFO [alembic.runtime.migration] Running upgrade 58eb7bdb93fe -> 1c9ba48be8e4, add uuidv7 function in SQL Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute cursor.execute(statement, parameters) psycopg2.errors.AmbiguousFunction: function name "uuidv7" is not unique HINT: Specify the argument list to select the function unambiguously. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/api/.venv/bin/flask", line 10, in <module> sys.exit(main()) ^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/cli.py", line 1131, in main cli.main() File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1383, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1850, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1850, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 1246, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/decorators.py", line 34, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/cli.py", line 400, in decorator return ctx.invoke(f, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/cli.py", line 154, in upgrade _upgrade(directory, revision, sql, tag, x_arg) File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 111, in wrapped f(*args, **kwargs) File "/app/api/.venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 200, in upgrade command.upgrade(config, revision, sql=sql, tag=tag) File "/app/api/.venv/lib/python3.12/site-packages/alembic/command.py", line 483, in upgrade script.run_env() File "/app/api/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 545, in run_env util.load_python_file(self.dir, "env.py") File "/app/api/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file module = load_module_py(module_id, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py spec.loader.exec_module(module) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap_external>", line 999, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/app/api/migrations/env.py", line 110, in <module> run_migrations_online() File "/app/api/migrations/env.py", line 104, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/app/api/.venv/lib/python3.12/site-packages/alembic/runtime/environment.py", line 946, in run_migrations self.get_context().run_migrations(**kw) File "/app/api/.venv/lib/python3.12/site-packages/alembic/runtime/migration.py", line 627, in run_migrations step.migration_fn(**kw) File "/app/api/migrations/versions/2025_07_02_2332-1c9ba48be8e4_add_uuidv7_function_in_sql.py", line 43, in upgrade op.execute(sa.text(r""" File "<string>", line 8, in execute File "<string>", line 3, in execute File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/ops.py", line 2591, in execute return operations.invoke(op) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/base.py", line 441, in invoke return fn(self, operation) ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/alembic/operations/toimpl.py", line 240, in execute_sql operations.migration_context.impl.execute( File "/app/api/.venv/lib/python3.12/site-packages/alembic/ddl/impl.py", line 253, in execute self._exec(sql, execution_options) File "/app/api/.venv/lib/python3.12/site-packages/alembic/ddl/impl.py", line 246, in _exec return conn.execute(construct, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute return meth( ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection return connection._execute_clauseelement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.AmbiguousFunction) function name "uuidv7" is not unique HINT: Specify the argument list to select the function unambiguously. [SQL: /* Main function to generate a uuidv7 value with millisecond precision */ CREATE FUNCTION uuidv7() RETURNS uuid AS $$ -- Replace the first 48 bits of a uuidv4 with the current -- number of milliseconds since 1970-01-01 UTC -- and set the "ver" field to 7 by setting additional bits SELECT encode( set_bit( set_bit( overlay(uuid_send(gen_random_uuid()) placing substring(int8send((extract(epoch from clock_timestamp()) * 1000)::bigint) from 3) from 1 for 6), 52, 1), 53, 1), 'hex')::uuid; $$ LANGUAGE SQL VOLATILE PARALLEL SAFE; COMMENT ON FUNCTION uuidv7 IS 'Generate a uuid-v7 value with a 48-bit timestamp (millisecond precision) and 74 bits of randomness'; ] (Background on this error at: https://sqlalche.me/e/20/f405) ```
yindo added the 🐞 bug label 2026-02-21 20:07:41 -05:00
yindo closed this issue 2026-02-21 20:07:41 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 22, 2025):

This migration failure happens because PostgreSQL 18 introduces a native uuidv7() function, which directly conflicts with the custom uuidv7() function defined in Dify's migration script. When the migration tries to create its own uuidv7(), PostgreSQL 18 sees multiple functions with the same name and signature, resulting in the "function name 'uuidv7' is not unique" error details.

This is especially problematic in managed/cloud PG18 environments, where you can't drop or alter built-in functions without superuser privileges, so manual cleanup isn't possible details.

Known workarounds:

  • Manually dropping all uuidv7 functions before migration works on self-managed databases, but not in cloud environments.
  • A practical workaround is to edit the migration script to create the function as public.uuidv7() instead of just uuidv7(). This avoids the conflict and allows the migration to succeed. For example, replace CREATE FUNCTION uuidv7() with CREATE FUNCTION public.uuidv7() and update any references accordingly details.
  • Downgrading to PostgreSQL <18 avoids the conflict, but isn't always feasible.

There is currently no official patch in Dify to handle this gracefully in all environments, but the maintainers are aware of the issue and the need for improved migration logic for PG18 compatibility discussion.

If you're blocked, the schema prefix workaround is the most reliable option for now. Keep an eye on the repo for future migration improvements.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 22, 2025): <!-- Answer --> This migration failure happens because PostgreSQL 18 introduces a native uuidv7() function, which directly conflicts with the custom uuidv7() function defined in Dify's migration script. When the migration tries to create its own uuidv7(), PostgreSQL 18 sees multiple functions with the same name and signature, resulting in the "function name 'uuidv7' is not unique" error [details](https://github.com/langgenius/dify/issues/27633). This is especially problematic in managed/cloud PG18 environments, where you can't drop or alter built-in functions without superuser privileges, so manual cleanup isn't possible [details](https://github.com/langgenius/dify/issues/27633). Known workarounds: - Manually dropping all uuidv7 functions before migration works on self-managed databases, but not in cloud environments. - A practical workaround is to edit the migration script to create the function as public.uuidv7() instead of just uuidv7(). This avoids the conflict and allows the migration to succeed. For example, replace `CREATE FUNCTION uuidv7()` with `CREATE FUNCTION public.uuidv7()` and update any references accordingly [details](https://github.com/langgenius/dify/issues/27633). - Downgrading to PostgreSQL <18 avoids the conflict, but isn't always feasible. There is currently no official patch in Dify to handle this gracefully in all environments, but the maintainers are aware of the issue and the need for improved migration logic for PG18 compatibility [discussion](https://github.com/langgenius/dify/issues/19754). If you're blocked, the schema prefix workaround is the most reliable option for now. Keep an eye on the repo for future migration improvements. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/aa35805f-fbe3-4d65-879a-70b3dcc19826?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20migration%20failure%20happens%20because%20PostgreSQL%2018%20introduces%20a%20native%20uuidv7%28%29%20function%2C%20which%20directly%20conflicts%20with%20the%20custom%20uuidv7%28%29%20function%20defined%20in%20Dify%27s%20migration%20script.%20When%20the%20migration%20tries%20to%20create%20its%20own%20uuidv7%28%29%2C%20PostgreSQL%2018%20sees%20multiple%20functions%20with%20the%20same%20name%20and%20signature%2C%20resulting%20in%20the%20%22function%20name%20%27uuidv7%27%20is%20not%20unique%22%20error%C2%A0%5Bdetails%5D%28https%3A//github.com/langgenius/dify/issues/27633%29.%0A%0AThis%20is%20especially%20problematic%20in%20managed/cloud%20PG18%20environments%2C%20where%20you%20can%27t%20drop%20or%20alter%20built-in%20functions%20without%20superuser%20privileges%2C%20so%20manual%20cleanup%20isn%27t%20possible%C2%A0%5Bdetails%5D%28https%3A//github.com/langgenius/dify/issues/27633%29.%0A%0AKnown%20workarounds%3A%0A-%20Manually%20dropping%20all%20uuidv7%20functions%20before%20migration%20works%20on%20self-managed%20databases%2C%20but%20not%20in%20cloud%20environments.%0A-%20A%20practical%20workaround%20is%20to%20edit%20the%20migration%20script%20to%20create%20the%20function%20as%20public.uuidv7%28%29%20instead%20of%20just%20uuidv7%28%29.%20This%20avoids%20the%20conflict%20and%20allows%20the%20migration%20to%20succeed.%20For%20example%2C%20replace%20%60CREATE%20FUNCTION%20uuidv7%28%29%60%20with%20%60CREATE%20FUNCTION%20public.uuidv7%28%29%60%20and%20update%20any%20references%20accordingly%C2%A0%5Bdetails%5D%28https%3A//github.com/langgenius/dify/issues/27633%29.%0A-%20Downgrading%20to%20PostgreSQL%20%3C18%20avoids%20the%20conflict%2C%20but%20isn%27t%20always%20feasible.%0A%0AThere%20is%20currently%20no%20official%20patch%20in%20Dify%20to%20handle%20this%20gracefully%20in%20all%20environments%2C%20but%20the%20maintainers%20are%20aware%20of%20the%20issue%20and%20the%20need%20for%20improved%20migration%20logic%20for%20PG18%20compatibility%C2%A0%5Bdiscussion%5D%28https%3A//github.com/langgenius/dify/issues/19754%29.%0A%0AIf%20you%27re%20blocked%2C%20the%20schema%20prefix%20workaround%20is%20the%20most%20reliable%20option%20for%20now.%20Keep%20an%20eye%20on%20the%20repo%20for%20future%20migration%20improvements.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28545)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20494