error on export db

Started by luccosen, December 29, 2023, 01:21:45 AM

Previous topic - Next topic

luccosen

Hi to all.,

 I receive this error when exporting the db, do you know a way to resolve it? .

ERROR: SQLite query failed: UNIQUE constraint failed: config.var_name
  Query: INSERT INTO config (var_name,var_value,default_value,is_visible,need_server_restart,data_type,is_public,description,units) VALUES ('DBConnectionPool.MaxLifetime','14400','14400','1','1','I','N','Maximum lifetime (in seconds) for a database connection.','seconds')
Database export failed.

Thank you

Filipp Sudanov

If you open Configuration->Server Configuration in management client and search for 
DBConnectionPool.MaxLifetime

 how many entries with such name are there? If two, delete one of them. 

What DB are you using, what is NetXMS version?

luccosen

I'm using postgres, and netxms 4.4.5.

thanks.

Filipp Sudanov

So how many entries are there in Configuration->Server Configuration ?

luccosen


Filipp Sudanov

Ok, and if you connect to your DB using postgres tools and run
select * from config where var_name = 'DBConnectionPool.MaxLifetime';

how many lines this query will produce?

luccosen

ok, I see 3 lines... Have I to delete 2? 

luccosen

wich is the correct command to delete only 2 row? 

thanks

Filipp Sudanov

This can be accomplished by copying only one row to a temporary table:

create temp table saved as select * from config where var_name = 'DBConnectionPool.MaxLifetime' limit 1;

delete from config where var_name = 'DBConnectionPool.MaxLifetime';

insert into config select * from saved;

luccosen

many thanks, but I found more row duplicate  :-\ ... then I adopted the query below...

delete from config a using config b where a=b and a.ctid < b.ctid;

it works well... also for all duplicate on db. 

I resolved.