I’m encountering an issue while importing data into a new PostgreSQL database created in PgAdmin. I’ve extracted the schema and data files from my working database and attempted to import them into the new database, but I’m running into an error related to the table “scontrini” not existing.
Problem Details:
- I created a new PostgreSQL database named “alphashop” using PgAdmin.
- I executed the schema.sql file to create the database schema.
- Next, I executed the data.sql file to import the data into the database.
- However, while executing the data.sql file, I receive the error:
ERROR: relation "scontrini" does not exist
LINE 1: SELECT SUM(totale) FROM scontrini WHERE codfi...
^
QUERY: SELECT SUM(totale) FROM scontrini WHERE codfid = NEW.codfid
CONTEXT: PL/pgSQL function public.tr_inserisci_coupon() line 4 at SQL statement
SQL state: 42P01
- I’ve verified that the “scontrini” table has been created in the database schema.
- I’ve also checked the order of script execution, ensuring that I’m running schema.sql first and then data.sql.
What I’ve Tried:
- Restarting PgAdmin.
- Verifying the encoding of the schema.sql and data.sql files, which is “UTF8”.
- Checking table dependencies in the data.sql file.
Additional Information:
- I’m using PgAdmin 4.3 on Ubuntu 20.04.
- I’m using PostgreSQL 14.