Page 1 of 1
Query failed: ERROR: duplicate key violates unique constrain
Posted: Tue Jun 01, 2004 12:37 pm
by ndv
Hi!
I'm not sure if this is a bug (maybe I did sth wrong during installation?), but FYI: I
sometimes got this warning on
my blog:
Warning: pg_query(): Query failed: ERROR: duplicate key violates unique constraint "url" . in /home/neodave/public_html/serendipity/serendipity_db_postgres.inc.php on line 63
This on Postgres 7.4
Re: Query failed: ERROR: duplicate key violates unique const
Posted: Tue Jun 01, 2004 12:45 pm
by garvinhicking
Hi!
Could you please set the $serendipity['procution'] value to '0' inside your serendipity_config.inc.php file? If that is set, the error message should be more verbose and I can have a look at it.
Sadly most of the users (including myself) use MySQL-DB and therefore I don't have that much experience with PgSQL...
Regards,
Garvin.
Posted: Tue Jun 01, 2004 1:15 pm
by ndv
sure, I just set production to 0.
Just in case this error won't be triggered up when you will be on my blog, I will copy here what I got:
Code: Select all
Notice: Undefined index: port in /home/neodave/public_html/serendipity/serendipity_functions.inc.php on line 2275
Notice: Undefined index: port in /home/neodave/public_html/serendipity/serendipity_functions.inc.php on line 2285
Notice: Undefined index: port in /home/neodave/public_html/serendipity/serendipity_functions.inc.php on line 2290
Warning: pg_query(): Query failed: ERROR: duplicate key violates unique constraint "url" . in /home/neodave/public_html/serendipity/serendipity_db_postgres.inc.php on line 63
Error in INSERT INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ('62.87.244.34', now(), 'http', 'php-blog.sourceforge.net', '', '/forums/viewtopic.php', 'p=840')
ERROR: duplicate key violates unique constraint "url" array (
0 =>
array (
'file' => '/home/neodave/public_html/serendipity/serendipity_functions.inc.php',
'line' => 2295,
'function' => 'serendipity_db_query',
'args' =>
array (
0 => 'INSERT INTO serendipity_suppress
(ip, last, scheme, host, port, path, query)
VALUES (\'62.87.244.34\', now(), \'http\', \'php-blog.sourceforge.net\', \'\', \'/forums/viewtopic.php\', \'p=840\')',
),
),
1 =>
array (
'file' => '/home/neodave/public_html/serendipity/index.php',
'line' => 184,
'function' => 'serendipity_track_referrer',
'args' =>
array (
),
),
)
INSERT INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ('62.87.244.34', now(), 'http', 'php-blog.sourceforge.net', '', '/forums/viewtopic.php', 'p=840')
Posted: Tue Jun 01, 2004 1:51 pm
by garvinhicking
Hi!
Thanks, your input was valuable. Could you now please edit your serendipity_config.inc.php and search for the serendipity_track_referrer function. You will then see something like:
Code: Select all
$suppressu = "INSERT INTO $serendipity[dbPrefix]suppress
(ip, last, scheme, host, port, path, query)
VALUES ('$_SERVER[REMOTE_ADDR]', now(), '$url_parts[scheme]', '$url_parts[host]', '$url_parts[port]', '$url_parts[path]', '$url_parts[query]')";
change that into:
Code: Select all
$suppressu = "REPLACE INTO $serendipity[dbPrefix]suppress
(ip, last, scheme, host, port, path, query)
VALUES ('$_SERVER[REMOTE_ADDR]', now(), '$url_parts[scheme]', '$url_parts[host]', '$url_parts[port]', '$url_parts[path]', '$url_parts[query]')";
That should do the trick for you - and please tell if it works, so we can include it into our codebase.
Thanks,
Garvin.
Posted: Tue Jun 01, 2004 2:28 pm
by ndv
I have found (and changed how you suggested)
serendipity_track_referrer() function in
serendipity_functions.inc.php file, not in
serendipity_config.inc.php, but I understand this was small mistake. ;)
However, fix seems to not work. :-(
Now I get:
Code: Select all
Warning: pg_query(): Query failed: ERROR: syntax error at or near "REPLACE" at character 1 . in /home/neodave/public_html/serendipity/serendipity_db_postgres.inc.php on line 63
Error in REPLACE INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ('62.87.244.34', now(), 'http', 'www.neodave.civ.pl', '', '/', '')
ERROR: syntax error at or near "REPLACE" at character 1 array (
0 =>
array (
'file' => '/home/neodave/public_html/serendipity/serendipity_functions.inc.php',
'line' => 2304,
'function' => 'serendipity_db_query',
'args' =>
array (
0 => 'REPLACE INTO serendipity_suppress
(ip, last, scheme, host, port, path, query)
VALUES (\'62.87.244.34\', now(), \'http\', \'www.neodave.civ.pl\', \'\', \'/\', \'\')',
),
),
1 =>
array (
'file' => '/home/neodave/public_html/serendipity/index.php',
'line' => 184,
'function' => 'serendipity_track_referrer',
'args' =>
array (
),
),
)
REPLACE INTO serendipity_suppress (ip, last, scheme, host, port, path, query) VALUES ('62.87.244.34', now(), 'http', 'www.neodave.civ.pl', '', '/', '')