Forum OpenACS Q&A: Response to "insert a duplicate key into unique index referer_log_pkey" error

I'm also getting these errors. Just to clarify, the exact line of SQL that is generating the errors is:
    Error: dbinit: error(localhost::servername,ERROR:  Cannot insert a duplicate key into unique index referer_log_pkey
    ): 'insert into referer_log (local_url, foreign_url, entry_date, click_count)
    select '/demo.tcl', 'http://www.servername.com/', trunc(sysdate()), 1
    from dual
    where 0 = (select count(*) 
               from referer_log
               where local_url = '/demo.tcl'
               and foreign_url = 'http://www.servername.com/'
               and trunc(entry_date) = trunc(sysdate()))'
I can't figure out why this SQL should fail? Is it possible that I have a corrupted database table? I'm running Postgres 7.0.2 under Redhat 7.1.