Error occurs when trying to run python manage.py migrate
in a django application.
complete code
git clone https://github.com/saleor/saleor.git
cd saleor
python manage.py migrate
Raised error
psycopg2.errors.UndefinedFunction: function gen_random_uuid() does not exist
LINE 1: UPDATE "account_user" SET "uuid" = GEN_RANDOM_UUID()
but works in running postgres
I created extention in postgres, commited that.
Here is code to create extention in postgres and call the function which is raising the above error, so this function is working but I am unable to call through django when I use postgres db
postgres=# `SELECT gen_random_uuid()`;
gen_random_uuid
Output is
--------------------------------------
f36d69b7-5681-4b92-b37e-9b0217b7d829
(1 row)
I tried to run this in docker and it works as expected
git clone https://github.com/saleor/saleor.git
cd saleor
python manage.py migrate
It works fine with docker.
I tried some other commands to check version and system, here PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit Thanks for comment. – Garuda
pg_lsclusters
15 main 5432 online postgres /var/lib/postgresql/15/main/var/log/postgresql/postgresql-15-main.log
----------------------------------------------------------
PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
Any help will be appreciated.