hello,
When i try to make a backup using :
QBcon.Open()
Dim Dump As PgSqlDump = New PgSqlDump
'Dim Dump_mode As DumpMode = New DumpMode = DumpMode.All
Dump.Connection = QBcon
'Dump.IncludeDrop = True
Dump.IncludeBlob = True
Dump.Mode = DumpMode.Data
' Dump.Schema = "fysio.store"
Dump.Backup("d:\test.sql")
QBcon.Close()
Its making a file.
then i try to restore using
Dim Dump As PgSqlDump = New PgSqlDump
Dump.DumpText = DMPtext
QBcon.Open()
Dim Pids_restore As PgSqlDump = New PgSqlDump
Pids_restore.Connection = QBcon
'Pids_restore.Mode = DumpMode.All
'Pids_restore.IncludeDrop = True
Pids_restore.IncludeBlob = True
Pids_restore.Restore("d:\test.sql")
QBcon.Close()
i get an error like:
duplicate key value violates unique constraint "pg_ts_cfg_pkey"
Please tell me what i am doing wrong here.
best regards
martijn
pgsql dump
You get this error because you are trying to insert data into the table with a primary key where the same values of the primary key column already exist (you have made a dump of the table, but have not cleared it before inserting data with the PgSqlDump.Restore() method).
As an alternative, try the following code where DumpMode.All is used instead of DumpMode.Data:
As an alternative, try the following code where DumpMode.All is used instead of DumpMode.Data:
Code: Select all
QBcon.Open()
Dim Dump As PgSqlDump = New PgSqlDump
Dump.Connection = QBcon
Dump.IncludeDrop = True
Dump.Mode = DumpMode.All //schema + data
Dump.Tables = "emp;dept" //the tables from my database
Dump.Backup("d:\test.sql")
//restoring schema and data from the file
Dump.Restore("d:\test.sql")
PgSqlConnection1.Close()
Thank you for your reply.
i omitted the .tables property as stated in the help but it seems to give a lot of problems.
anyway another question:
is there a way to tell when the backupprocedure is totally finished?
I like to let my users know when the whole process is finished with the backup and go on with my program and or check the backup.
thank you in advance.....
i omitted the .tables property as stated in the help but it seems to give a lot of problems.
anyway another question:
is there a way to tell when the backupprocedure is totally finished?
I like to let my users know when the whole process is finished with the backup and go on with my program and or check the backup.
thank you in advance.....