Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#8511 closed defect (fixed)

After trac update to 0.12.1: duplicate key value violates unique constraint "forum_pkey"

Reported by: podskalsky Owned by: Radek Bartoň
Priority: highest Component: DiscussionPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

After Trac update to 0.12.1 and PluginUpdate to 0.7 ...

we can't create new entries (New Forum + Add Topic) !!!

ERROR: Trac detected an internal error:
IntegrityError: duplicate key value violates unique constraint "topic_pkey"

WHAT CAN BE WRONG ?

VERSIONS:

psql (8.4.5)

System Information:

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Trac 	0.12.1
Babel 	0.9.5
CustomFieldAdmin 	0.2.5
Docutils 	0.8
FullBlog 	0.1.1
Genshi 	0.6
mod_wsgi 	3.3 (WSGIProcessGroup NexusTest WSGIApplicationGroup %{GLOBAL})
psycopg2 	2.3.0-beta1
Pygments 	1.3.1
Python 	2.6.5 (r265:79063, Jul 14 2010, 11:36:05) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)]
pytz 	2010h
RPC 	1.1.0
setuptools 	0.6
SilverCity 	0.9.7
Subversion 	1.6.11 (r934486)
jQuery	1.4.2
Enabled Plugins:
AdvancedTicketWorkflowPlugin 	0.10dev 	/usr/lib/python2.6/site-packages/AdvancedTicketWorkflowPlugin-0.10dev-py2.6.egg
DocumentGeneratorPlugin 	0.2.8 	/usr/lib/python2.6/site-packages/DocumentGeneratorPlugin-0.2.8-py2.6.egg
graphviz 	0.7.5 	/usr/lib/python2.6/site-packages/graphviz-0.7.5-py2.6.egg
HudsonTrac 	0.4 	/usr/lib/python2.6/site-packages/HudsonTrac-0.4-py2.6.egg
LittleMary 	1.0 	/usr/lib/python2.6/site-packages/LittleMary-1.0-py2.6.egg
MultipleWorkflowPlugin 	1.0 	/usr/lib/python2.6/site-packages/MultipleWorkflowPlugin-1.0-py2.6.egg
NavAdd 	0.1 	/usr/lib/python2.6/site-packages/NavAdd-0.1-py2.6.egg
nexus-commit-updater 	N/A 	/data/projects/NexusTest/trac/plugins/nexus_commit_updater.pyc
OnTracIniManager 	0.2.1 	/usr/lib/python2.6/site-packages/OnTracIniManager-0.2.1-py2.6.egg
OnTracSVNAccessControl 	0.1 	/usr/lib/python2.6/site-packages/OnTracSVNAccessControl-0.1-py2.6.egg
OnTracTheme 	1.0 	/usr/lib/python2.6/site-packages/OnTracTheme-1.0-py2.6.egg
OnTracTicketFieldFilter 	0.1 	/usr/lib/python2.6/site-packages/OnTracTicketFieldFilter-0.1-py2.6.egg
OnTracTicketValiator 	0.1 	/usr/lib/python2.6/site-packages/OnTracTicketValiator-0.1-py2.6.egg
OnTracUserManager 	0.3 	/usr/lib/python2.6/site-packages/OnTracUserManager-0.3-py2.6.egg
ServerControl 	0.3 	/usr/lib/python2.6/site-packages/ServerControl-0.3-py2.6.egg
SVN-URLs 	0.6 	/usr/lib/python2.6/site-packages/SVN_URLs-0.6-py2.6.egg
ticket-clone 	Rev 	/data/projects/NexusTest/trac/plugins/ticket_clone.pyc
TicketCreationStatus 	0.1 	/usr/lib/python2.6/site-packages/TicketCreationStatus-0.1-py2.6.egg
TracAutoWikify 	0.1 	/usr/lib/python2.6/site-packages/TracAutoWikify-0.1-py2.6.egg
TracCustomFieldAdmin 	0.2.5 	/usr/lib/python2.6/site-packages/TracCustomFieldAdmin-0.2.5-py2.6.egg
TracDiscussion 	0.7 	/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg
TracFullBlogPlugin 	0.1.1 	/usr/lib/python2.6/site-packages/TracFullBlogPlugin-0.1.1-py2.6.egg
TracNav 	4.1 	/usr/lib/python2.6/site-packages/TracNav-4.1-py2.6.egg
TracPrivateTickets 	2.0.2 	/usr/lib/python2.6/site-packages/TracPrivateTickets-2.0.2-py2.6.egg
TracSVNAuthz 	0.11.1.1 	/usr/lib/python2.6/site-packages/TracSVNAuthz-0.11.1.1-py2.6.egg
TracTags 	0.7dev 	/usr/lib/python2.6/site-packages/TracTags-0.7dev-py2.6.egg
TracThemeEngine 	2.0.1 	/usr/lib/python2.6/site-packages/TracThemeEngine-2.0.1-py2.6.egg
TracTocMacro 	11.0.0.3 	/usr/lib/python2.6/site-packages/TracTocMacro-11.0.0.3-py2.6.egg
TracVirtualTicketPermissions 	1.0.0 	/usr/lib/python2.6/site-packages/TracVirtualTicketPermissions-1.0.0-py2.6.egg
TracWikiRename 	2.1.1 	/usr/lib/python2.6/site-packages/TracWikiRename-2.1.1-py2.6.egg
TracWysiwyg 	0.12.0.3 	/usr/lib/python2.6/site-packages/TracWysiwyg-0.12.0.3-py2.6.egg
TracXMLRPC 	1.1.0 	/usr/lib/python2.6/site-packages/TracXMLRPC-1.1.0-py2.6.egg
WikiEditLock 	0.2 	/usr/lib/python2.6/site-packages/WikiEditLock-0.2-py2.6.egg
WikiTableMacro 	0.1 	/usr/lib/python2.6/site-packages/WikiTableMacro-0.1-py2.6.egg
OUTPUT:


# File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request
Code fragment:
Line	
506	try:
507	if not env and env_error:
508	raise HTTPInternalError(env_error)
509	try:
510	dispatcher = RequestDispatcher(env)
511	dispatcher.dispatch(req)
512	except RequestDone:
513	pass
514	resp = req._response or []
515	 
516	except HTTPException, e:
Local variables:
Name	Value
dispatcher 	<trac.web.main.RequestDispatcher object at 0x7f1049085c10>
e 	IntegrityError('duplicate key value violates unique constraint ...
env 	<trac.env.Environment object at 0x7f10489dc850>
env_error 	None
req 	<Request "POST '/discussion/forum/4'">
resp 	[]
# File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch
Code fragment:
Line	
232	msg = _('Do you have cookies enabled?')
233	raise HTTPBadRequest(_('Missing or invalid form token.'
234	' %(msg)s', msg=msg))
235	 
236	# Process the request and render the template
237	resp = chosen_handler.process_request(req)
238	if resp:
239	if len(resp) == 2: # Clearsilver
240	chrome.populate_hdf(req)
241	template, content_type = \
242	self._post_process_request(req, *resp)
Local variables:
Name	Value
chosen_handler 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
chrome 	<trac.web.chrome.Chrome object at 0x7f104908f950>
ctype 	'application/x-www-form-urlencoded'
err 	(<class 'psycopg2.IntegrityError'>, IntegrityError('duplicate key value ...
handler 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
options 	{}
req 	<Request "POST '/discussion/forum/4'">
self 	<trac.web.main.RequestDispatcher object at 0x7f1049085c10>
# File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/core.py", line 111, in process_request
Code fragment:
Line	
106	Mimeview(self.env).send_converted(req, 'tracdiscussion.forum',
107	context.resource, req.args.get('format'), filename = None)
108	 
109	# Process request and return content.
110	api = self.env[DiscussionApi]
111	template, data = api.process_discussion(context)
112	 
113	if context.redirect_url:
114	# Redirect if needed.
115	href = req.href(context.redirect_url[0]) + context.redirect_url[1]
116	self.log.debug(_("Redirecting to %s") % (href))
Local variables:
Name	Value
api 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
context 	<Context <Resource u'discussion:forum/4'>>
req 	<Request "POST '/discussion/forum/4'">
self 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
# File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 245, in process_discussion
Code fragment:
Line	
240	or '{}')
241	context.visited_topics = eval(context.req.session.get('visited-topics')
242	or '{}')
243	 
244	# Perform actions.
245	self._do_actions(context, actions)
246	 
247	# Update session data.
248	context.req.session['visited-topics'] = to_unicode(context.visited_topics)
249	context.req.session['visited-forums'] = to_unicode(context.visited_forums)
250	 
Local variables:
Name	Value
actions 	['topic-post-add']
context 	<Context <Resource u'discussion:forum/4'>>
db 	<trac.db.pool.PooledConnection object at 0x7f1049a5d0a0>
self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
# File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 960, in _do_actions
Code fragment:
Line	
955	topic = topic_or_error
956	else:
957	raise TracError(topic_or_error)
958	 
959	# Add new topic.
960	self.add_topic(context, topic)
961	 
962	# Get inserted topic with new ID.
963	context.topic = self.get_topic_by_time(context, topic['time'])
964	 
965	# Notify change listeners.
Local variables:
Name	Value
action 	'topic-post-add'
actions 	['topic-post-add']
context 	<Context <Resource u'discussion:forum/4'>>
self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
# File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1745, in add_topic
Code fragment:
Line	
1740	tmp_topic = deepcopy(topic)
1741	 
1742	# Pack subscribers field.
1743	tmp_topic['subscribers'] = ' '.join(tmp_topic['subscribers'])
1744	 
1745	self._add_item(context, 'topic', tmp_topic)
1746	 
1747	def add_message(self, context, message):
1748	self._add_item(context, 'message', message)
1749	 
1750	# Delete items functions.
Local variables:
Name	Value
context 	<Context <Resource u'discussion:forum/4'>>
self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
tmp_topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
# File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1724, in _add_item
Code fragment:
Line	
1719	'values' : ', '.join(["%s" for I in range(len(values))])}
1720	sql = ("INSERT INTO %(table)s "
1721	"(%(fields)s) "
1722	"VALUES (%(values)s)" % (sql_values))
1723	self.log.debug(sql % values)
1724	context.cursor.execute(sql, values)
1725	 
1726	def add_group(self, context, group):
1727	self._add_item(context, 'forum_group', group)
1728	 
1729	def add_forum(self, context, forum):
Local variables:
Name	Value
I 	5
context 	<Context <Resource u'discussion:forum/4'>>
fields 	('body', 'forum', 'author', 'subscribers', 'time', 'subject')
item 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
sql 	'INSERT INTO topic (body, forum, author, subscribers, time, subject) ...
sql_values 	{'table': 'topic', 'values': '%s, %s, %s, %s, %s, %s', 'fields': 'body, ...
table 	'topic'
values 	(u'Enter youadadadr message here...', 4, u'AndreasPodskalsky', '', ...
# File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/db/util.py", line 65, in execute 

Attachments (0)

Change History (10)

comment:1 Changed 14 years ago by Radek Bartoň

Status: newassigned

Thank you for reporting this issue. Why are you using v0.7? Which revision is that? Lastest revision is v0.8. Could you re-paste (or better edit) your logs in readable form (put them into {{{}}} environment). Could you provide debug log since there is printed the actual executed SQL command. Could you post result of select id from topic? Thank you.

comment:2 in reply to:  1 Changed 14 years ago by anonymous

trac_NexusTest=# select id from topic;
 id
----
 10
  2
 14
 24
  1
  3
  4
  5
  6
  7
 31
  8
  9
 11
 13
 15
 16
 17
 12
 18
 20
 23
 21
 22
 26
 27
 28
 25
 29
 30
(30 rows)

trac_NexusTest=# select id from forum;
 id
----
  1
  4
  5
  7
(4 rows)

comment:3 Changed 14 years ago by anonymous

First we will try to update to 0.8 . But at 0.7 we see that errors. After update I will send you the new state ...

New Forum >>> IntegrityError: duplicate key value violates unique constraint "forum_pkey"

Add Topic >>> IntegrityError: duplicate key value violates unique constraint "topic_pkey"

psql (8.4.5)

Python Traceback
Most recent call last:

    * File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request
      Code fragment:
      Line	
      506	try:
      507	if not env and env_error:
      508	raise HTTPInternalError(env_error)
      509	try:
      510	dispatcher = RequestDispatcher(env)
      511	dispatcher.dispatch(req)
      512	except RequestDone:
      513	pass
      514	resp = req._response or []
      515	 
      516	except HTTPException, e:
      Local variables:
      Name	Value
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x7f1049085c10>
      e 	IntegrityError('duplicate key value violates unique constraint ...
      env 	<trac.env.Environment object at 0x7f10489dc850>
      env_error 	None
      req 	<Request "POST '/discussion/forum/4'">
      resp 	[]
    * File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch
      Code fragment:
      Line	
      232	msg = _('Do you have cookies enabled?')
      233	raise HTTPBadRequest(_('Missing or invalid form token.'
      234	' %(msg)s', msg=msg))
      235	 
      236	# Process the request and render the template
      237	resp = chosen_handler.process_request(req)
      238	if resp:
      239	if len(resp) == 2: # Clearsilver
      240	chrome.populate_hdf(req)
      241	template, content_type = \
      242	self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
      chrome 	<trac.web.chrome.Chrome object at 0x7f104908f950>
      ctype 	'application/x-www-form-urlencoded'
      err 	(<class 'psycopg2.IntegrityError'>, IntegrityError('duplicate key value ...
      handler 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
      options 	{}
      req 	<Request "POST '/discussion/forum/4'">
      self 	<trac.web.main.RequestDispatcher object at 0x7f1049085c10>
    * File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/core.py", line 111, in process_request
      Code fragment:
      Line	
      106	Mimeview(self.env).send_converted(req, 'tracdiscussion.forum',
      107	context.resource, req.args.get('format'), filename = None)
      108	 
      109	# Process request and return content.
      110	api = self.env[DiscussionApi]
      111	template, data = api.process_discussion(context)
      112	 
      113	if context.redirect_url:
      114	# Redirect if needed.
      115	href = req.href(context.redirect_url[0]) + context.redirect_url[1]
      116	self.log.debug(_("Redirecting to %s") % (href))
      Local variables:
      Name	Value
      api 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
      context 	<Context <Resource u'discussion:forum/4'>>
      req 	<Request "POST '/discussion/forum/4'">
      self 	<tracdiscussion.core.DiscussionCore object at 0x7f10490850d0>
    * File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 245, in process_discussion
      Code fragment:
      Line	
      240	or '{}')
      241	context.visited_topics = eval(context.req.session.get('visited-topics')
      242	or '{}')
      243	 
      244	# Perform actions.
      245	self._do_actions(context, actions)
      246	 
      247	# Update session data.
      248	context.req.session['visited-topics'] = to_unicode(context.visited_topics)
      249	context.req.session['visited-forums'] = to_unicode(context.visited_forums)
      250	 
      Local variables:
      Name	Value
      actions 	['topic-post-add']
      context 	<Context <Resource u'discussion:forum/4'>>
      db 	<trac.db.pool.PooledConnection object at 0x7f1049a5d0a0>
      self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
    * File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 960, in _do_actions
      Code fragment:
      Line	
      955	topic = topic_or_error
      956	else:
      957	raise TracError(topic_or_error)
      958	 
      959	# Add new topic.
      960	self.add_topic(context, topic)
      961	 
      962	# Get inserted topic with new ID.
      963	context.topic = self.get_topic_by_time(context, topic['time'])
      964	 
      965	# Notify change listeners.
      Local variables:
      Name	Value
      action 	'topic-post-add'
      actions 	['topic-post-add']
      context 	<Context <Resource u'discussion:forum/4'>>
      self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
      topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
    * File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1745, in add_topic
      Code fragment:
      Line	
      1740	tmp_topic = deepcopy(topic)
      1741	 
      1742	# Pack subscribers field.
      1743	tmp_topic['subscribers'] = ' '.join(tmp_topic['subscribers'])
      1744	 
      1745	self._add_item(context, 'topic', tmp_topic)
      1746	 
      1747	def add_message(self, context, message):
      1748	self._add_item(context, 'message', message)
      1749	 
      1750	# Delete items functions.
      Local variables:
      Name	Value
      context 	<Context <Resource u'discussion:forum/4'>>
      self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
      tmp_topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
      topic 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
    * File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1724, in _add_item
      Code fragment:
      Line	
      1719	'values' : ', '.join(["%s" for I in range(len(values))])}
      1720	sql = ("INSERT INTO %(table)s "
      1721	"(%(fields)s) "
      1722	"VALUES (%(values)s)" % (sql_values))
      1723	self.log.debug(sql % values)
      1724	context.cursor.execute(sql, values)
      1725	 
      1726	def add_group(self, context, group):
      1727	self._add_item(context, 'forum_group', group)
      1728	 
      1729	def add_forum(self, context, forum):
      Local variables:
      Name	Value
      I 	5
      context 	<Context <Resource u'discussion:forum/4'>>
      fields 	('body', 'forum', 'author', 'subscribers', 'time', 'subject')
      item 	{'body': u'Enter youadadadr message here...', 'forum': 4, 'author': ...
      self 	<tracdiscussion.api.DiscussionApi object at 0x7f1049085790>
      sql 	'INSERT INTO topic (body, forum, author, subscribers, time, subject) ...
      sql_values 	{'table': 'topic', 'values': '%s, %s, %s, %s, %s, %s', 'fields': 'body, ...
      table 	'topic'
      values 	(u'Enter youadadadr message here...', 4, u'AndreasPodskalsky', '', ...
    * File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/db/util.py", line 65, in execute
      Code fragment:
      Line	
      60	return r
      61	except Exception, e:
      62	self.log.debug('execute exception: %r', e)
      63	raise
      64	if args:
      65	return self.cursor.execute(sql_escape_percent(sql), args)
      66	return self.cursor.execute(sql)
      67	 
      68	def executemany(self, sql, args):
      69	if self.log:
      70	self.log.debug('SQL: %r', sql)
      Local variables:
      Name	Value
      args 	(u'Enter youadadadr message here...', 4, u'AndreasPodskalsky', '', ...
      self 	<trac.db.util.IterableCursor object at 0x7f1049a65590>
      sql 	'INSERT INTO topic (body, forum, author, subscribers, time, subject) ...

File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/core.py", line 111, in process_request
  template, data = api.process_discussion(context)
File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 245, in process_discussion
  self._do_actions(context, actions)
File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 960, in _do_actions
  self.add_topic(context, topic)
File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1745, in add_topic
  self._add_item(context, 'topic', tmp_topic)
File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/api.py", line 1724, in _add_item
  context.cursor.execute(sql, values)
File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)

System Information:

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Trac 	0.12.1
Babel 	0.9.5
CustomFieldAdmin 	0.2.5
Docutils 	0.8
FullBlog 	0.1.1
Genshi 	0.6
mod_wsgi 	3.3 (WSGIProcessGroup NexusTest WSGIApplicationGroup %{GLOBAL})
psycopg2 	2.3.0-beta1
Pygments 	1.3.1
Python 	2.6.5 (r265:79063, Jul 14 2010, 11:36:05) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)]
pytz 	2010h
RPC 	1.1.0
setuptools 	0.6
SilverCity 	0.9.7
Subversion 	1.6.11 (r934486)
jQuery	1.4.2
Enabled Plugins:
AdvancedTicketWorkflowPlugin 	0.10dev 	/usr/lib/python2.6/site-packages/AdvancedTicketWorkflowPlugin-0.10dev-py2.6.egg
DocumentGeneratorPlugin 	0.2.8 	/usr/lib/python2.6/site-packages/DocumentGeneratorPlugin-0.2.8-py2.6.egg
graphviz 	0.7.5 	/usr/lib/python2.6/site-packages/graphviz-0.7.5-py2.6.egg
HudsonTrac 	0.4 	/usr/lib/python2.6/site-packages/HudsonTrac-0.4-py2.6.egg
LittleMary 	1.0 	/usr/lib/python2.6/site-packages/LittleMary-1.0-py2.6.egg
MultipleWorkflowPlugin 	1.0 	/usr/lib/python2.6/site-packages/MultipleWorkflowPlugin-1.0-py2.6.egg
NavAdd 	0.1 	/usr/lib/python2.6/site-packages/NavAdd-0.1-py2.6.egg
nexus-commit-updater 	N/A 	/data/projects/NexusTest/trac/plugins/nexus_commit_updater.pyc
OnTracIniManager 	0.2.1 	/usr/lib/python2.6/site-packages/OnTracIniManager-0.2.1-py2.6.egg
OnTracSVNAccessControl 	0.1 	/usr/lib/python2.6/site-packages/OnTracSVNAccessControl-0.1-py2.6.egg
OnTracTheme 	1.0 	/usr/lib/python2.6/site-packages/OnTracTheme-1.0-py2.6.egg
OnTracTicketFieldFilter 	0.1 	/usr/lib/python2.6/site-packages/OnTracTicketFieldFilter-0.1-py2.6.egg
OnTracTicketValiator 	0.1 	/usr/lib/python2.6/site-packages/OnTracTicketValiator-0.1-py2.6.egg
OnTracUserManager 	0.3 	/usr/lib/python2.6/site-packages/OnTracUserManager-0.3-py2.6.egg
ServerControl 	0.3 	/usr/lib/python2.6/site-packages/ServerControl-0.3-py2.6.egg
SVN-URLs 	0.6 	/usr/lib/python2.6/site-packages/SVN_URLs-0.6-py2.6.egg
ticket-clone 	Rev 	/data/projects/NexusTest/trac/plugins/ticket_clone.pyc
TicketCreationStatus 	0.1 	/usr/lib/python2.6/site-packages/TicketCreationStatus-0.1-py2.6.egg
TracAutoWikify 	0.1 	/usr/lib/python2.6/site-packages/TracAutoWikify-0.1-py2.6.egg
TracCustomFieldAdmin 	0.2.5 	/usr/lib/python2.6/site-packages/TracCustomFieldAdmin-0.2.5-py2.6.egg
TracDiscussion 	0.7 	/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg
TracFullBlogPlugin 	0.1.1 	/usr/lib/python2.6/site-packages/TracFullBlogPlugin-0.1.1-py2.6.egg
TracNav 	4.1 	/usr/lib/python2.6/site-packages/TracNav-4.1-py2.6.egg
TracPrivateTickets 	2.0.2 	/usr/lib/python2.6/site-packages/TracPrivateTickets-2.0.2-py2.6.egg
TracSVNAuthz 	0.11.1.1 	/usr/lib/python2.6/site-packages/TracSVNAuthz-0.11.1.1-py2.6.egg
TracTags 	0.7dev 	/usr/lib/python2.6/site-packages/TracTags-0.7dev-py2.6.egg
TracThemeEngine 	2.0.1 	/usr/lib/python2.6/site-packages/TracThemeEngine-2.0.1-py2.6.egg
TracTocMacro 	11.0.0.3 	/usr/lib/python2.6/site-packages/TracTocMacro-11.0.0.3-py2.6.egg
TracVirtualTicketPermissions 	1.0.0 	/usr/lib/python2.6/site-packages/TracVirtualTicketPermissions-1.0.0-py2.6.egg
TracWikiRename 	2.1.1 	/usr/lib/python2.6/site-packages/TracWikiRename-2.1.1-py2.6.egg
TracWysiwyg 	0.12.0.3 	/usr/lib/python2.6/site-packages/TracWysiwyg-0.12.0.3-py2.6.egg
TracXMLRPC 	1.1.0 	/usr/lib/python2.6/site-packages/TracXMLRPC-1.1.0-py2.6.egg
WikiEditLock 	0.2 	/usr/lib/python2.6/site-packages/WikiEditLock-0.2-py2.6.egg
WikiTableMacro 	0.1 	/usr/lib/python2.6/site-packages/WikiTableMacro-0.1-py2.6.egg

comment:4 Changed 14 years ago by anonymous

hi,

i'm the admin who's responsible for the trac-server of the original poster...

we've updated now to plugin version 0.8 (revison r9871), but the error is the same!

br, christian

comment:5 Changed 14 years ago by Radek Bartoň

OK, it seems that DB tables are already broken by the update. So post me DB schema of your forum and topic tables to see what is wrong. Also the actual SQL command executed from the debug log would be fine.

comment:7 Changed 14 years ago by anonymous

here's the dump:

--
-- Name: forum; Type: TABLE; Schema: public; Owner: trac; Tablespace:
--

CREATE TABLE forum (
    id integer NOT NULL,
    name text,
    "time" integer,
    forum_group integer,
    author text,
    moderators text,
    subscribers text,
    subject text,
    description text
);


ALTER TABLE public.forum OWNER TO trac;

--
-- Name: forum_id_seq; Type: SEQUENCE; Schema: public; Owner: trac
--

CREATE SEQUENCE forum_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.forum_id_seq OWNER TO trac;

--
-- Name: forum_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: trac
--

ALTER SEQUENCE forum_id_seq OWNED BY forum.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: trac
--

ALTER TABLE forum ALTER COLUMN id SET DEFAULT nextval('forum_id_seq'::regclass);


--
-- Name: forum_pkey; Type: CONSTRAINT; Schema: public; Owner: trac; Tablespace:
--

ALTER TABLE ONLY forum
    ADD CONSTRAINT forum_pkey PRIMARY KEY (id);


--
-- Name: forum_time_idx; Type: INDEX; Schema: public; Owner: trac; Tablespace:
--

CREATE INDEX forum_time_idx ON forum USING btree ("time");


--
-- PostgreSQL database dump complete
--


--
-- Name: topic; Type: TABLE; Schema: public; Owner: trac; Tablespace:
--

CREATE TABLE topic (
    id integer NOT NULL,
    forum integer,
    "time" integer,
    author text,
    subscribers text,
    subject text,
    body text,
    status integer DEFAULT 0 NOT NULL,
    priority integer DEFAULT 0 NOT NULL
);


ALTER TABLE public.topic OWNER TO trac;

--
-- Name: topic_id_seq; Type: SEQUENCE; Schema: public; Owner: trac
--

CREATE SEQUENCE topic_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.topic_id_seq OWNER TO trac;

--
-- Name: topic_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: trac
--

ALTER SEQUENCE topic_id_seq OWNED BY topic.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: trac
--

ALTER TABLE topic ALTER COLUMN id SET DEFAULT nextval('topic_id_seq'::regclass);


--
-- Name: topic_pkey; Type: CONSTRAINT; Schema: public; Owner: trac; Tablespace:
--

ALTER TABLE ONLY topic
    ADD CONSTRAINT topic_pkey PRIMARY KEY (id);


--
-- PostgreSQL database dump complete
--


the executed SQL-command (and traceback) is:

2011-02-17 18:24:43,713 Trac[api] DEBUG: req.args: {'body': u'Enter your message here...\r\nasdf\r\nasdf\r\nasdf\r\n', 'forum': u'1', 'author': u'ChristianMasopust', 'unregistered_subscribers': u'', 'submit': u'Submit', '__FORM_TOKEN': u'c5dbf496125e4d3be9390f9d', '__EDITOR__1': u'textarea', 'discussion_action': u'post-add', 'subject': u'Just a test'}
2011-02-17 18:24:43,713 Trac[api] DEBUG: INSERT INTO topic (body, status, forum, author, subscribers, time, subject) VALUES (Enter your message here...^M
asdf^M
asdf^M
asdf^M
,0,1,ChristianMasopust,,1297963483,Just a test)
2011-02-17 18:24:43,715 Trac[chrome] DEBUG: Prepare chrome data for request
2011-02-17 18:24:43,716 Trac[main] DEBUG: Negotiated locale: None -> en_US
2011-02-17 18:24:43,740 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/core.py", line 112, in process_request
    template, data = api.process_discussion(context)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 259, in process_discussion
    self._do_actions(context, actions)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 1047, in _do_actions
    self.add_topic(context, topic)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 2090, in add_topic
    self._add_item(context, 'topic', tmp_topic)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 2063, in _add_item
    context.cursor.execute(sql, values)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
IntegrityError: duplicate key value violates unique constraint "topic_pkey"
IntegrityError: duplicate key value violates unique constraint "topic_pkey"


thanks a lot for your (very quick!) help!
christian

comment:8 Changed 14 years ago by Radek Bartoň

Hmm, I'm not much PostgreSQL expert but I don't see anything wrong. Maybe except that there is sometimes tables and sequences referenced with public schema prefix and sometimes not in the schema definition. But this won't be the problem.

I'd try two things: Try to execute the command from psql console:

INSERT INTO topic (body, status, forum, author, subscribers, time, subject) VALUES ('test', 0, 1, 'ChristianMasopust', '', 1297963483, 'test')

and if this fail too then check if the sequence is not broken. I mean that there should be some kind of system table where the last nuber for the sequence is stored. Check if this value is not lower than 31 which is the last ID of your topics. I don't know how are the sequences implemented in the PostgreSQL but I suppose there is something like that.

comment:9 in reply to:  8 Changed 14 years ago by anonymous

Resolution: fixed
Status: assignedclosed

Replying to Blackhex:

Hmm, I'm not much PostgreSQL expert but I don't see anything wrong. Maybe except that there is sometimes tables and sequences referenced with public schema prefix and sometimes not in the schema definition. But this won't be the problem.

I'd try two things: Try to execute the command from psql console:

INSERT INTO topic (body, status, forum, author, subscribers, time, subject) VALUES ('test', 0, 1, 'ChristianMasopust', '', 1297963483, 'test')

and if this fail too then check if the sequence is not broken. I mean that there should be some kind of system table where the last nuber for the sequence is stored. Check if this value is not lower than 31 which is the last ID of your topics. I don't know how are the sequences implemented in the PostgreSQL but I suppose there is something like that.

also the direct insert (via the sql-command above) fails. but your hint to the sequence helped a lot! yes, you're right, there are some problems with the auto-generated sequences... don't know where these problems come from, but will check also all other sequences.

do you probably know a way how to "automatically" regenerate the sequences? (if not, no problem... will continue tomorrow as it's already late here and time for me to go to bed :-))

again thanks a lot, and i think we can close this ticket.

christian

comment:10 Changed 14 years ago by Radek Bartoň

No, I never did that. Good night.

comment:11 Changed 14 years ago by Ryan J Ollos

Description: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.