Hi, I got this error in odoo 12 after importing a database from a computer to another:
psycopg2.ProgrammingError: relation «ir_attachment_id_seq» does not exist
LINE 1: ...res_model", "type", "website_id") VALUES (nextval('ir_attach...
^
Error to render compiling AST
ProgrammingError: no existe la relación «ir_attachment_id_seq»
LINE 1: ...res_model", "type", "website_id") VALUES (nextval('ir_attach...
^
Template: website.layout
Path: /templates/t/t/t[5]/t[6]
Node:
------ SOLUTION --------
The error was because the original database was Postgres 10 but my local database is Postgres 9.6, the dump.sql file in the .zip file contains "to integer" in the script and Postgres 9.X doesn't support this operation.
To fix this error you need decompress the .zip file and edit the dump.sql deleting all the "to integer", after deleting all ocurrence compress all the files again and restore the backup.
If your dump.sql file is larger than 500 MB I recomend using a terminal text like nano or vim in linux to replace all the "as integer" ocurrencies to avoid overflowing your RAM memory