On 2022-09-07 5:27 AM, Uwe Schuerkamp wrote:
sql_create.c:483 Create DB Media record INSERT INTO Media
(VolumeName,MediaType,MediaTypeId,PoolId,MaxVolBytes,VolCapacityBytes,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime,VolType,VolParts,VolCloudParts,LastPartBytes,EndFile,EndBlock,LabelType,StorageId,DeviceId,LocationId,ScratchPoolId,RecyclePoolId,Enabled,ActionOnPurge,CacheRetention)VALUES
('testvolume','File_zif',0,5,0,0,1,3456000,0,1,0,'Append',0,231,0,0,0,1,0,0,'0',0,0,0,2,0,0,0,0,1,1,0)
failed. ERR=ERROR: duplicate key value violates unique constraint "media_pkey"
DETAIL: Key (mediaid)=(1) already exists.
You'll need to look at the DDL and see how mediaid is defined: hopefully
it's a 'default next value for $some_sequence' (whatever postgres syntax
is for that), then you find the the next available number from media
table. I.e. if the last mediaid in mysql dump is 42, you want
$some_sequence start with 43.
psql> alter sequence $some_sequence restart with 43;
(Or, before the import, you can edit the DDL and change $some_sequence
definition to 'start with 43'.)
Repeat for all sequences in the database. (There is a '\d - something'
command in psql to list all sequences.)
Dima
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users