SimpleMultiProjectPlugin: Create new project, undefinedTable: relation "smp_project_id_seq" does not exist

61 views
Skip to first unread message

Mo

unread,
Feb 22, 2021, 2:41:37 AM2/22/21
to Trac Users

Hello,

we can't create new projects anymore using TracSimpleMultiProject-0.7.2.dev0 on Trac-1.4:
https://trac-hacks.org/ticket/13955

Any idea how to solve this?

Here is the error message with callstack:

UndefinedTable: relation "smp_project_id_seq" does not exist
LINE 1: SELECT CURRVAL('"smp_project_id_seq"')

File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/trac/web/main.py", line 639, in dispatch_request         
  dispatcher.dispatch(req)
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/trac/web/main.py", line 250, in dispatch         
  resp = chosen_handler.process_request(req)
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/trac/admin/web_ui.py", line 104, in process_request         
  resp = provider.render_admin_panel(req, cat_id, panel_id, path_info)
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/simplemultiproject/admin_project.py", line 85, in render_admin_panel         
  self.smp_project.add(name, summary, description, None, 'YES' if restricted else None)
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/simplemultiproject/smp_model.py", line 213, in add         
  prj_id = db.get_last_id(cursor, 'smp_project')
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/trac/db/postgres_backend.py", line 372, in get_last_id         
  (self.quote(self._sequence_name(table, column)),))
File "/mnt/data/trac/virtualenv/lib/python2.7/site-packages/trac/db/util.py", line 73, in execute         
  return self.cursor.execute(sql_escape_percent(sql), args)

RjOllos

unread,
Feb 22, 2021, 3:19:27 PM2/22/21
to Trac Users
It might be helpful to see the descriptions of the tables:

The only significant changes to the smp_project table where made in:
If you installed an earlier version, maybe the table primary key is still "id" rather than "id_project"?

We try to stick to cross-db compatible types in Trac: text, int, int64. TracSimpleMultiProject uses varchar, which on quick look might be compatible on all 3 supported databases, but I'm not certain.

Ryan

Mo

unread,
Feb 24, 2021, 1:56:38 AM2/24/21
to Trac Users
RjOllos schrieb am Montag, 22. Februar 2021 um 21:19:27 UTC+1:
The only significant changes to the smp_project table where made in:
If you installed an earlier version, maybe the table primary key is still "id" rather than "id_project"?

Not the case here, column is named id_project. We have been using SimpleMultiProjectPlugin for many years after that change in 2012.
 
We try to stick to cross-db compatible types in Trac: text, int, int64. TracSimpleMultiProject uses varchar, which on quick look might be compatible on all 3 supported databases, but I'm not certain.

If this has not changed recently then it can't be the cause either.

Best regards,
Mo

Jun Omae

unread,
Feb 27, 2021, 1:20:55 AM2/27/21
to trac-...@googlegroups.com
It seems that the author of the plugin has not tested creating a
project with PostgreSQL on applying r11785.


Index: simplemultiproject/model.py
===================================================================
--- simplemultiproject/model.py (revision 18015)
+++ simplemultiproject/model.py (working copy)
@@ -137,7 +137,7 @@
""", (self.id, self.name, _to_null(self.summary),
_to_null(self.description), _to_null(self.closed),
'YES' if self.restricted else None))
- self.id = db.get_last_id(cursor, 'smp_project')
+ self.id = db.get_last_id(cursor, 'smp_project', 'id_project')
# keep internal ticket custom field data up to date
self.refresh_ticket_custom_list()




--
Jun Omae <jun...@gmail.com> (大前 潤)

Mo

unread,
Mar 1, 2021, 1:32:08 AM3/1/21
to Trac Users
Jun Omae schrieb am Samstag, 27. Februar 2021 um 07:20:55 UTC+1:

It seems that the author of the plugin has not tested creating a
project with PostgreSQL on applying r11785.

Yes, we are using PostgreSQL, so what can we do now?
But I doubt it's about a change from 2012 as we were starting using it later and have been updating continuously.

Best regards,
Mo

Jun Omae

unread,
Mar 1, 2021, 3:42:27 AM3/1/21
to trac-...@googlegroups.com
On Mon, Mar 1, 2021 at 3:32 PM Mo <burcheri...@gmail.com> wrote:
>
> Jun Omae schrieb am Samstag, 27. Februar 2021 um 07:20:55 UTC+1:
>>
>>
>> It seems that the author of the plugin has not tested creating a
>> project with PostgreSQL on applying r11785.
>
> Yes, we are using PostgreSQL, so what can we do now?

Please try the proposed patch in my mail.
If the issue is not fixed, please provide results of \ds <schema.>
using psql shell.


trac=> \dn
List of schemas
Name | Owner
-----------+----------
public | postgres
trac_0_12 | tracuser
trac_1_0 | tracuser
trac_1_2 | tracuser
trac_1_5 | tracuser
tractest | tracuser
(6 rows)

trac=> \ds trac_1_2.
List of relations
Schema | Name | Type | Owner
----------+----------------------------+----------+----------
trac_1_2 | node_change_id_seq | sequence | tracuser
trac_1_2 | notify_subscription_id_seq | sequence | tracuser
trac_1_2 | notify_watch_id_seq | sequence | tracuser
trac_1_2 | report_id_seq | sequence | tracuser
trac_1_2 | ticket_id_seq | sequence | tracuser
(5 rows)

Mo

unread,
Mar 4, 2021, 5:14:40 AM3/4/21
to Trac Users
Jun Omae schrieb am Samstag, 27. Februar 2021 um 07:20:55 UTC+1:

Index: simplemultiproject/model.py
===================================================================
--- simplemultiproject/model.py (revision 18015)
+++ simplemultiproject/model.py (working copy)
@@ -137,7 +137,7 @@
""", (self.id, self.name, _to_null(self.summary),
_to_null(self.description), _to_null(self.closed),
'YES' if self.restricted else None))
- self.id = db.get_last_id(cursor, 'smp_project')
+ self.id = db.get_last_id(cursor, 'smp_project', 'id_project')
# keep internal ticket custom field data up to date
self.refresh_ticket_custom_list()


Something is wrong with the patch:
 patch: **** malformed patch at line 6: """, (self.id, self.name, _to_null(self.summary),

I'm working now on the trunk of https://trac-hacks.org/svn/simplemultiprojectplugin, r18041.

However I adapted the line 140 manually to
self.id = db.get_last_id(cursor, 'smp_project', 'id_project')
which did not help.

Mo

unread,
Mar 4, 2021, 5:16:40 AM3/4/21
to Trac Users
Jun Omae schrieb am Montag, 1. März 2021 um 09:42:27 UTC+1:

Please try the proposed patch in my mail.
If the issue is not fixed, please provide results of \ds <schema.>
using psql shell.

I'm connected with pgAdmin 4, how can I help you there?

Jun Omae

unread,
Mar 4, 2021, 5:36:43 AM3/4/21
to trac-...@googlegroups.com
Please provide list of sequence objects in your schema.

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/c1536467-fb98-4ef5-9221-db1e1e1785a4n%40googlegroups.com.

Mo

unread,
Mar 8, 2021, 6:06:56 AM3/8/21
to Trac Users
Jun Omae schrieb am Donnerstag, 4. März 2021 um 11:36:43 UTC+1:
Please provide list of sequence objects in your schema.

trac-pp=> \ds

                     List of relations
 Schema |             Name              |   Type   | Owner
--------+-------------------------------+----------+-------
 public | forum_group_id_seq            | sequence | trac
 public | forum_id_seq                  | sequence | trac
 public | message_id_seq                | sequence | trac
 public | node_change_id_seq            | sequence | trac
 public | notify_subscription_id_seq    | sequence | trac
 public | notify_watch_id_seq           | sequence | trac
 public | report_id_seq                 | sequence | trac
 public | smp_component_project_id_seq  | sequence | trac
 public | smp_milestone_project_id_seq  | sequence | trac
 public | smp_project_id_project_seq    | sequence | trac
 public | smp_version_project_id_seq    | sequence | trac
 public | subscription_attribute_id_seq | sequence | trac
 public | subscription_id_seq           | sequence | trac
 public | ticket_id_seq                 | sequence | trac
 public | ticket_time_id_seq            | sequence | trac
 public | ticket_time_query_id_seq      | sequence | trac
 public | topic_id_seq                  | sequence | trac
 public | xmail_id_seq                  | sequence | trac
(18 rows)
 
Does that help you?

BR,
Mo

Mo

unread,
Mar 10, 2021, 5:50:08 AM3/10/21
to Trac Users
Does the Schema list help you to see the issue?

Is only the /admin/smproject/projects dialog broken?
I tried adding a new project by adding an item to

[ticket-custom]
project.options = FOO|BAR|NEW


but it does not appear in a new ticket dialog or in the admin settings.

Best regards,
Mo

Mo

unread,
Mar 15, 2021, 11:52:25 AM3/15/21
to Trac Users
Hi, this is quite urgent in the meantime. How can I help fixing the plugin?

Best regards,
Mo

RjOllos

unread,
Mar 24, 2021, 1:21:30 AM3/24/21
to Trac Users
I haven't had time to look, but note the sequence in your schema is smp_project_id_project_seq and the patch seems like it should fix the issue:

Line 207 in smp_model.py may need the same change:

Do you get the same error with the patch?

Ryan

Mo

unread,
Mar 24, 2021, 12:04:46 PM3/24/21
to Trac Users
RjOllos schrieb am Mittwoch, 24. März 2021 um 06:21:30 UTC+1:
I haven't had time to look, but note the sequence in your schema is smp_project_id_project_seq and the patch seems like it should fix the issue:

Thank you very much, that patch solved the issue.
Would you like to submit this patch to the plugin trunk?

I need to revise my info about Trac-1.4, I already have 1.4.2, and this alone was not solving the issue, only the last patch you pointed to.

Best regards,
Mo


RjOllos

unread,
Mar 24, 2021, 1:39:26 PM3/24/21
to Trac Users
Would be great if you can create a patch file and attach it to the issue:


Ryan 

RjOllos

unread,
Mar 24, 2021, 1:43:49 PM3/24/21
to Trac Users
Reply all
Reply to author
Forward
0 new messages