<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Migration from PostgreSQL to TimescaleDB failed]]></title><description><![CDATA[<p dir="auto">I've tried to migrate the data form PostgreSQL format to TimescaleDB. But it failed with following error messages:</p>
<pre><code># nxdbmgr migrate /etc/netxmsd.conf.pgsql
NetXMS Database Manager Version 3.3.340 Build 3.3-340-gdde893b7a5 (UNICODE)

Source:
        Driver: pgsql.ddr
        DB Name: netxms
        DB Server: 127.0.0.1
        DB Login: netxms

Target:
        Driver: pgsql.ddr
        DB Name: timescale
        DB Server: 127.0.0.1
        DB Login: netxms

Options:
        Skip audit log.............: no
        Skip alarm log.............: no
        Skip event log.............: no
        Skip syslog................: no
        Skip SNMP trap log.........: no
        Skip collected data........: no
        Skip data collection schema: no

Confirm database migration? (Yes/No) y
Database driver pgsql.ddr loaded
Connected to source database


WARNING!!!
This operation will clear all configuration and collected data from destination database before migration.
Are you sure? (Yes/No) y
Database successfully cleared
Migrating table config
Migrating table config_clob
Migrating table config_values
Migrating table users

...

Migrating table idata_160 to idata
Migrating table tdata_160 to tdata
Migrating table idata_164 to idata
ERROR: unable to insert data to destination table (23505 ERROR:  duplicate key value violates unique constraint "2161_2161_idata_sc_default_pkey"
DETAIL:  Key (item_id, idata_timestamp)=(1227, 2020-05-19 02:01:11+02) already exists.)
ERROR: unable to insert data to destination table (23505 ERROR:  duplicate key value violates unique constraint "2161_2161_idata_sc_default_pkey"
DETAIL:  Key (item_id, idata_timestamp)=(1227, 2020-05-19 14:25:13+02) already exists.)
ERROR: unable to insert data to destination table (23505 ERROR:  duplicate key value violates unique constraint "2161_2161_idata_sc_default_pkey"
DETAIL:  Key (item_id, idata_timestamp)=(1227, 2020-05-19 05:13:12+02) already exists.)

...

ERROR: unable to insert data to destination table (23505 ERROR:  duplicate key value violates unique constraint "2721_2721_idata_sc_default_pkey"
DETAIL:  Key (item_id, idata_timestamp)=(1227, 2020-05-28 22:45:14+02) already exists.)
ERROR: unable to insert data to destination table (23505 ERROR:  duplicate key value violates unique constraint "2721_2721_idata_sc_default_pkey"
DETAIL:  Key (item_id, idata_timestamp)=(1227, 2020-05-29 01:59:14+02) already exists.)
Database migration failed.
</code></pre>
<p dir="auto">The server version is 3.3.340 on Debian.<br />
Did I do something wrong or PostgreSQL uses different keys than TimescaleDB?<br />
How can I correct the problem?</p>
]]></description><link>https://forum.netxms.org/topic/6558/migration-from-postgresql-to-timescaledb-failed</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 15:51:31 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/6558.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Jun 2020 12:00:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Migration from PostgreSQL to TimescaleDB failed on Thu, 04 Jun 2020 18:41:05 GMT]]></title><description><![CDATA[<p dir="auto">Yes, this should solve the issue. Duplicate records are definitely a bug, but keeping them will not help in debugging it anyway.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/28009</link><guid isPermaLink="true">https://forum.netxms.org/post/28009</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 04 Jun 2020 18:41:05 GMT</pubDate></item><item><title><![CDATA[Reply to Migration from PostgreSQL to TimescaleDB failed on Thu, 04 Jun 2020 15:19:49 GMT]]></title><description><![CDATA[<p dir="auto">I think deleting the duplicate records will solve the problem.<br />
Can I do it or will you need same more tests on my DB?</p>
]]></description><link>https://forum.netxms.org/post/28007</link><guid isPermaLink="true">https://forum.netxms.org/post/28007</guid><dc:creator><![CDATA[pvo]]></dc:creator><pubDate>Thu, 04 Jun 2020 15:19:49 GMT</pubDate></item><item><title><![CDATA[Reply to Migration from PostgreSQL to TimescaleDB failed on Thu, 04 Jun 2020 14:18:47 GMT]]></title><description><![CDATA[<p dir="auto">It returns 2 rows.</p>
<p dir="auto">The table idata_160 has no primary key. Better to say that none of the idata_??? tables has a primary key. It is defined only on the idata table.<br />
The idata_??? tables have item_id and idata_timestamp index only.</p>
]]></description><link>https://forum.netxms.org/post/28006</link><guid isPermaLink="true">https://forum.netxms.org/post/28006</guid><dc:creator><![CDATA[pvo]]></dc:creator><pubDate>Thu, 04 Jun 2020 14:18:47 GMT</pubDate></item><item><title><![CDATA[Reply to Migration from PostgreSQL to TimescaleDB failed on Thu, 04 Jun 2020 13:50:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">it looks like duplicate records in source table, although it is quite strange because PostgreSQL schema should have timestamp as part of primary key as well. Please try to run query</p>
<pre><code>SELECT * FROM idata_164 WHERE item_id=1227 AND idata_timestamp=1589846471;
</code></pre>
<p dir="auto">on original database - how many records it will produce?</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/28005</link><guid isPermaLink="true">https://forum.netxms.org/post/28005</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 04 Jun 2020 13:50:26 GMT</pubDate></item></channel></rss>