Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4 Antwoorden
16807 Weergaven
Hi, 

just wanted to try out odoo16. When installing modules like sale or product I get this error:
psycopg2.errors.UndefinedFunction: function jsonb_path_query_array(jsonb, unknown) does not exist LINE 1: ...ate_name_index" ON "product_template" USING gin ((jsonb_path... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Im using PostgreSQL 10.0, which is supported according to the documentation.



Thank you!

Avatar
Annuleer

Can you tell me where you see PostgreSQL 10.0 is supported for Odoo 16?

Our install documentation shows that only versions 12.0 and later are supported.

https://www.odoo.com/documentation/16.0/administration/install/install.html#postgresql

Beste antwoord

Hi, I had the same issue so I checked on postgresql documentation and the function "jsonb_path_query_array" is not available before postgres 12. I upgraded to postgresql 12 and it worked for me.

Hope it will help you

Avatar
Annuleer

Hello Quentin,
i tried to upgrade postgresql but failed , can you provide doc to updgrade

Hello Hedaia,
Here is the guide I followed:

A) First create a backup of all the databases for that (You can continue from B if you dont need a backup)

Log in as postgres user
sudo su postgres
Create a backup .sql file for all the data you have in all the databases
pg_dumpall > backup.sql
B) Upgrade to PostgreSQL12

update packages and install postgres 12
sudo apt-get update
sudo apt-get install postgresql-12 postgresql-server-dev-12
Stop the postgresql service
sudo systemctl stop postgresql.service
migrate the data
/usr/lib/postgresql/12/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/10/main \
--new-datadir=/var/lib/postgresql/12/main \
--old-bindir=/usr/lib/postgresql/10/bin \
--new-bindir=/usr/lib/postgresql/12/bin \
--old-options '-c config_file=/etc/postgresql/10/main/postgresql.conf' \
--new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf'
Switch to regular user
exit
Swap the ports the old and new postgres versions.
#change port to 5432
sudo vim /etc/postgresql/12/main/postgresql.conf
#change port to 5433
sudo vim /etc/postgresql/10/main/postgresql.conf
Start the postgresql service
sudo systemctl start postgresql.service
Log in as postgres user
sudo su postgres
Check your new postgres version
psql -c "SELECT version();"
Run the generated new cluster script
./analyze_new_cluster.sh
Return as a normal(default user) user and cleanup up the old version's mess
#uninstalls postgres packages
sudo apt-get remove postgresql-10 postgresql-server-dev-10
#removes the old postgresql directory
sudo rm -rf /etc/postgresql/10/
#login as postgres user
sudo su postgres
#delete the old cluster data
./delete_old_cluster.sh
Congrads! Your postgresql version is now upgraded, If everything works well in B, we dont have to apply the backup as we have already migrated the data from the older version to the newer version, the backup is just in case if anything goes wrong.
NOTE: Change the postgresql.conf and pg_hba.conf as per your requirement

source : https://stackoverflow.com/questions/60409585/how-to-upgrade-postgresql-database-from-10-to-12-without-losing-data-for-openpro

Beste antwoord

Hi,

You have to use postgresql 12 or above for odoo 16. If you are using lower version you will receive this error.


Thanks

Avatar
Annuleer
Auteur

I have odoo 16.0 in my docker file

then Andreas, you need to build new image locally with newer version.

Beste antwoord

I run into the same problem with the exact same specifications. Postgres 10 and Odoo 16.0

Avatar
Annuleer
Beste antwoord

I faced the same above issue in odoo16 in ubuntu18.4 after installing postgresql12. And I tried this steps and odoo16 is working fine now.

Step 1) Go to odoo -> modules -> registry.py file and command the below lines

# if field.translate:
# column_expression = f'''(jsonb_path_query_array({column_expression}, '$.*')::text)'''

Step 2) replace the below line with existing expression and method variables.

expression = f'{column_expression}'

method = 'btree'

It will work now.

Avatar
Annuleer

the case is that, you may have multiple postgres version in your machine and odoo is still running with older postgres version.

when you are having multiple postgres, adjust the db_port in odoo conf file to take the correct postgres version, you can try with db_port=5433 or 5434

Gerelateerde posts Antwoorden Weergaven Activiteit
3
aug. 25
2770
1
mei 25
2728
1
apr. 25
3710
1
apr. 25
4573
1
apr. 25
2022