Modify

Opened 20 months ago

Last modified 9 months ago

#10812 new defect

Error when using code reviews function

Reported by: anonymous Owned by: olemis
Priority: high Component: PeerReviewPlugin
Severity: critical Keywords:
Cc: rjollos, andy.barreras@… Trac Release: 1.0

Description (last modified by rjollos)

Using Trac 1.0 on Apache via PostgresSQL backend. When I click on the "Peer Review" navigation button, I receive the following error:

Trac detected an internal error:

ProgrammingError: relation "codereviews" does not exist
LINE 1: ...iew, Author, Status, DateCreate, Name, Notes FROM CodeReview...
                                                             ^
Python Traceback
Most recent call last:

    File "c:/docume~1/svchou~1/locals~1/temp/easy_install-tyu9e_/Trac-1.0-py2.7-win32.egg.tmp/trac/web/main.py", line 497, in _dispatch_request
    File "c:/docume~1/svchou~1/locals~1/temp/easy_install-tyu9e_/Trac-1.0-py2.7-win32.egg.tmp/trac/web/main.py", line 214, in dispatch
    File "build/bdist.win32/egg/codereview/peerReviewMain.py", line 74, in process_request
    File "build/bdist.win32/egg/codereview/dbBackend.py", line 37, in getMyCodeReviews
    File "build/bdist.win32/egg/codereview/dbBackend.py", line 177, in execCodeReviewQuery
    File "c:/docume~1/svchou~1/locals~1/temp/easy_install-tyu9e_/Trac-1.0-py2.7-win32.egg.tmp/trac/db/util.py", line 66, in execute 

Attachments (0)

Change History (5)

comment:1 Changed 20 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 20 months ago by rjollos

  • Cc andy.barreras@… added

#10822 closed as a duplicate.

comment:3 follow-up: Changed 13 months ago by anonymous

The cheap way to fix this is to change db_default.py to lowercase all
the table and column names. The problem stems from the db tables being created
with mixed/upper case letters that I assume are quoted during creation
but then are not quoted when used (or possibly lower case names are used).

Once I did the change I was able to have the plugin run on both 0.12.2 and 1.0.1
(although it didn't run correctly e.g. no way to add files to a review).

An example of the change is:

#The tables for the Code Review Plugin
tables = [
    Table('codereviews', key='idreview')[
        Column('idreview', auto_increment=True, type='int'),
        Column('author'),
        Column('status'),
        Column('datecreate', type='int'),
        Column('name'),
        Column('notes'),
    ],
...

Note that the table names, key and all column names are lowercase.

Further info on case issues with databases can be found at:

http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html

comment:4 Changed 9 months ago by jun66j5

#11456 was closed as a duplicate.

comment:5 in reply to: ↑ 3 Changed 9 months ago by rjollos

Replying to anonymous:

The cheap way to fix this is to change db_default.py to lowercase all
the table and column names. The problem stems from the db tables being created
with mixed/upper case letters that I assume are quoted during creation
but then are not quoted when used (or possibly lower case names are used).

As noted in #11456, we'll also need an upgrade step.

There is string interpolation when creating the query strings in dbBackend.py, which should also be fixed.

Generally speaking, this plugin is a mess.

Once I did the change I was able to have the plugin run on both 0.12.2 and 1.0.1
(although it didn't run correctly e.g. no way to add files to a review).

That issue was likely addressed in #11184.

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.