We will transfer the local database PostgreSQL to a remote server using the program PyCharm…
We already have a connected local database in PyCharm. And also in it we are connected to a remote database.
To avoid problems with users when working with databases on different systems, you must adhere to the same names, otherwise errors will occur during import:
Command was: ALTER TABLE public.users_settings_id_seq OWNER TO “UserName”;
pg_restore: from TOC entry 219; 1259 57835 TABLE volumes UserName
pg_restore: error: could not execute query: ERROR: role “UserName” does not exist
In the local database, put the cursor on public:
And choose Export with ‘pg_dump’:
Select the parameters as in the screenshot below and export to a convenient folder for us:
Now for the remote server we also put the cursor on the public directory, but now we select the item Restore with ‘pg_restore’:
This process is not the fastest. Perhaps next time we will analyze the import in a different way.