Page 1 of 1

Query failed: ERROR: duplicate key violates unique...

Posted: Thu Apr 07, 2005 2:39 pm
by mjxg
I am new to s9y, but I am loving it. I have encountered an error that I can't fix, and I haven't been able to find an answer in the forums that's worked.

I looked at the thread http://www.s9y.org/forums/viewtopic.php ... int+urlidx which is the exact same error I am getting, but I have not seen any fixes yet.

I am using the latest version of s9y, and postgresql. Here's the error I am getting:

Code: Select all

Warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key violates unique constraint "url_idx" in /usr/local/www/data-dist/yaaat.com/include/db/postgres.inc.php on line 107
Error in INSERT INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ( '129.21.143.240', NOW(), 'http', 'www.livejournal.com', '', '/users/bangspank/friends', '' )
ERROR: duplicate key violates unique constraint "url_idx"
array (
  0 => 
  array (
    'file' => '/usr/local/www/data-dist/yaaat.com/include/functions.inc.php',
    'line' => 472,
    'function' => 'serendipity_db_query',
    'args' => 
    array (
      0 => 'INSERT INTO serendipity_suppress
                      (ip, last, scheme, host, port, path, query)
                      VALUES (
                      \'129.21.143.240\',
                      NOW(),
                      \'http\',
                      \'www.livejournal.com\',
                      \'\',
                      \'/users/bangspank/friends\',
                      \'\'
                      )',
    ),
  ),
  1 => 
  array (
    'file' => '/usr/local/www/data-dist/yaaat.com/index.php',
    'line' => 161,
    'function' => 'serendipity_track_referrer',
    'args' => 
    array (
      0 => 2,
    ),
  ),
) 
INSERT INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ( '129.21.143.240', NOW(), 'http', 'www.livejournal.com', '', '/users/bangspank/friends', '' )
My blog can be found at http://www.mjxg.com

Re: Query failed: ERROR: duplicate key violates unique...

Posted: Thu Apr 07, 2005 4:05 pm
by garvinhicking
Thanks for the hint; indeed this message could happen and the unique constrant is not really needed anymore.

You can drop the url_idx key:

Code: Select all

DROP INDEX url_idx;
I've done so in our latest CVS, and it will be part of our upcoming 0.8 release.

Regards,
Garvin