[rt-users] DBD::Pg::st execute failed: ERROR: duplicate key value violates unique constraint "articles_pkey" at [...]/DBIx/SearchBuilder/Handle.pm

Joop jvdwege at xs4all.nl
Tue Sep 30 03:09:08 EDT 2014


On 29-9-2014 22:41, Lee Damon wrote:
> Greetings,
>
> TL;DR:
> I am in the process of trying to migrate an ancient RT 3.6.4 version
> to 4.2.7. Most of the migration works -- old tickets and articles can
> be read, new tickets can be created via the web interface -- but
> creation of new articles fails with "[warning]: DBD::Pg::st execute
> failed: ERROR:  duplicate key value violates unique constraint
> "articles_pkey" at
> /usr/nikola/pkgs/perl/.5.20.0/lib/site_perl/5.20.0/DBIx/SearchBuilder/Handle.pm
> line 589.
> (/usr/nikola/pkgs/perl/.5.20.0/lib/site_perl/5.20.0/DBIx/SearchBuilder/Handle.pm:589)
> [799] [Mon Sep 22 19:44:42 2014] [warning]: RT::Handle=HASH(0x8980380)
> couldn't execute the query 'INSERT INTO Articles (Class, Name,
> Creator, LastUpdatedBy, Summary, LastUpdated, Created) VALUES (?, ?,
> ?, ?, ?, ?, ?)' at
> /usr/nikola/pkgs/perl/.5.20.0/lib/site_perl/5.20.0/DBIx/SearchBuilder/Handle.pm
> line 602."
> (Full text of the logged error is at the end of this email)
>
I wonder if you create a new article in the old instance if you then get
the same error.
I suspect that the sequence that populates the primary key of the
articles tables is lower than the latest article. One work around is to
set the sequence to the highest id+1 of the article table
Fire up your favourite postgres client and connect with your rt_admin to
your rt instance, do 'select max(id) from articles;' this should give a
number and then do 'select last_value from articles_id_seq;' this number
should equal the previous one but I suspect that the last one will be
lower than the first.

Regards,

Joop




More information about the rt-users mailing list