Search code examples
sqlpostgresqlalembic

PostgresSQL incompatible query between version 10 and 14


I have the following statement, which runs fine on PostgresSQL version 10

LINE 1: UPDATE tablename SET "cliPrefix"=encode(digest(gen_random_uuid()::text, 'sha512'), 'hex');
                                                ^

But on PostgresSQL version 14 this line gave me the error:

No function matches the given name and argument types. You might need to add explicit type casts

How to fix this?


Solution

  • Check if exists the required extension (pgcrypto)

    select * from pg_extension;
    

    if not

    create extension pgcrypto;