Edgewall Software
Modify

Opened 18 years ago

Closed 17 years ago

Last modified 9 years ago

#3715 closed defect (worksforme)

Report execution failed: Report 9 has no SQL query.

Reported by: sungje@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10b1
Severity: critical Keywords: report needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I meet "Report execution failed: Report 9 has no SQL query." error message creating the new report. I write the title, Description and Query as following.

title

test

Description

only test

Query
(same as no.6)

SELECT p.value AS __color__,
   t.milestone AS __group__,
   (CASE status 
      WHEN 'closed' THEN 'color: #777; background: #ddd; border-color: #ccc;'
      ELSE 
        (CASE owner WHEN '$USER' THEN 'font-weight: bold' END)
    END) AS __style__,
   id AS ticket, summary, component, status, 
   resolution,version, t.type AS type, priority, owner,
   changetime AS modified,
   time AS _time,reporter AS _reporter
  FROM ticket t,enum p
  WHERE p.name=t.priority AND p.type='priority'
  ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'), 
        (CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END) DESC

I use the trac and subversion on the window 2003 server with the Apache server. SQLite is version 3(SQLite3.exe)

Attachments (0)

Change History (30)

comment:1 by Matthew Good, 18 years ago

Keywords: needinfo added

If you click "Edit Report" after getting that error is the SQL part filled in? I've tried the report you provided and it works fine. That error only occurs if the SQL field is blank.

comment:2 by Christian Boos, 18 years ago

Keywords: needinfo removed
Milestone: 0.10
Resolution: worksforme
Status: newclosed

I can't reproduce this either.

However, I was about to close this as worksforme, when I noticed that I was having a strange lock, a complete freeze of tracd actually, apparently triggered by deleting reports… Weird, reminds me of the kind of freeze I've seen with #3332… More specifically, the delete apparently succeeeded, but the browser was stuck waiting on the confirm delete page, and no other request could succeed nor triggered any reaction in the trac log…

Anyway, I'm closing this now, and probably open another ticket for the freeze issue when I understand a bit more what's going on…

comment:3 by anonymous, 18 years ago

Resolution: worksforme
Status: closedreopened

I have the same issue. Whenever I attempt to create or edit a new report the SQL query field is not saved.

i.e. after creating a new report and doing a .dump of the reports table in sqlite3 I get:

INSERT INTO "report" VALUES(9, NULL, 'test', '', 'test test');

Found this out the hard way when trying to change the way report 1 looks. I was able to manually add the SQL into the report table to fix it. At first I thought it could be because of the webamdmin plugin because it worked fine before I installed the plugin, however after disabling the plugin creating/editing/copying reports still did not work. Completely weird. (deleting reports works fine)

I am also using 0.10b1/sqlite3/apache2 but on debian.

in reply to:  3 ; comment:4 by Christian Boos, 18 years ago

Keywords: needinfo added
Milestone: 0.10.1

Replying to anonymous:

I have the same issue. Whenever I attempt to create or edit a new report the SQL query field is not saved. …

Anything in the logs? If not, try setting the log level to DEBUG, and retry.

in reply to:  4 comment:5 by anonymous, 18 years ago

When saving a report nothing is added to the logs. When viewing a report without the sql part nothing appears in the log. When viewing a report that does have an sql query the sql query is added to the log.

comment:6 by anonymous, 18 years ago

It appears that the _do_save method is loading the form element 'query' rather than the form element 'sql'. Either the page template needs to be changed or the _do_save method. (Looks like an over zealous search-and-replace for sql→query in that method.)

comment:7 by Christian Boos, 18 years ago

It could well be that you're using a customized templates/report.cs.

Look at source:tags/trac-0.10/templates/report.cs@#L224, the <textarea> containing the SQL query is indeed identified as query; see also r3300.

If that's indeed the case, update your customized template in your $TRAC_ENV/templates (if it needs to be kept customized, otherwise simply remove it) and then please don't forget to close this ticket as worksforme, thanks!

comment:8 by anonymous, 18 years ago

Severity: normalcritical

We have exactly the same problem. If you hit Save query (even if you haven't edited anything), the report is saved with the query being empty.

comment:9 by anonymous, 18 years ago

Addtional information to the above post.

We haven't modified the templates or source code at all. Here's what our report.cs template on line 224 looks like…

<div class="field">

<label for="query">

SQL Query for Report:</label><br />

<textarea id="query" name="query" cols="85" rows="20"><?cs

var:report.sql ?></textarea>

</div>

comment:10 by anonymous, 18 years ago

Addional information for above post.

I updated the trac version from 0.9.x to 0.10.0 including the datbases (ran the upgrade data base script).

comment:11 by eoin.dunne@…, 18 years ago

Additional information for the above post:

In report.py I've wrapped the elif action with a try except to see if trac was failing silently somehow here's the code I dropped in:

elif action == 'edit':

try:

self.log.info('this is a test') query = req.args.get('query', ) self.log.info('Query = ' + query ) self._do_save(req, db, id) self.log.info('done test')

except Exception, ex:

self.log.info( ex )

I never see the "Done test" message in the log. Here's the stack trace I capture below.

stack trace:

2006-11-08 15:01:19,891 Trac[report] INFO: this is a test 2006-11-08 15:01:19,891 Trac[report] INFO: Query = 2006-11-08 15:01:19,891 Trac[report] INFO: 2006-11-08 15:01:19,907 Trac[main] ERROR: Response already started Traceback (most recent call last):

File "C:\Python24\Lib\site-packages\trac\web\main.py", line 356, in dispatch_request

dispatcher.dispatch(req)

File "C:\Python24\Lib\site-packages\trac\web\main.py", line 228, in dispatch

req.display(template, content_type or 'text/html')

File "C:\Python24\Lib\site-packages\trac\web\api.py", line 360, in display

self.end_headers()

File "C:\Python24\Lib\site-packages\trac\web\api.py", line 277, in end_headers

self._write = self._start_response(self._status, self._outheaders)

File "C:\Python24\Lib\site-packages\trac\web\wsgi.py", line 111, in _start_response

assert not self.headers_set, 'Response already started'

AssertionError: Response already started

Anyway hope this helps.

in reply to:  11 comment:12 by Christian Boos, 18 years ago

Replying to eoin.dunne@divestco.com:

… AssertionError: Response already started

Now that 0.10.1 is out, can you upgrade to that version and try again?

Also, please create a new test environment from scratch (initenv) and try to see if this happens also there.

comment:13 by anonymous, 18 years ago

Upgrading to 0.10.1 fixed the problem. I didn't bother creating a test trac instance as upgrading fixed the existing trac instances.

Existing sql that should show up now does in the Edit Report SQL Query Text field.

It's probably safe to close this ticket now.

At least from my perspective.

comment:14 by Christian Boos, 18 years ago

Milestone: 0.10.2
Resolution: worksforme
Status: reopenedclosed

Ok, so it works for me too ;)

comment:15 by Christian Boos, 18 years ago

Keywords: needinfo removed

in reply to:  11 comment:16 by Matthew Good, 18 years ago

Replying to eoin.dunne@divestco.com:

Additional information for the above post:

In report.py I've wrapped the elif action with a try except to see if trac was failing silently somehow here's the code I dropped in:

             elif action == 'edit':
                 try:
                     self.log.info('this is a test')
                     query = req.args.get('query', '')
                     self.log.info('Query = ' + query )
                     self._do_save(req, db, id) 
                     self.log.info('done test')
                 except Exception, ex:
                     self.log.info( ex )

I never see the "Done test" message in the log. Here's the stack trace I capture below.

That's expected since _do_save does a redirect which raises the RequestDone exception to end the request.

comment:17 by eoin.dunne@…, 18 years ago

sorry. Are you saying you use an exception essentially as a goto statement to conditionally not execute code????? You deliberately raise an exception to end the request?

comment:18 by Christian Boos, 18 years ago

No, of course not! gotos are only meant to be used in a local scope.

We actually use the exception as a longjmp() ;)

comment:19 by anonymous, 18 years ago

hmmm.

long jump hey. nice.

so while(true):

longjump()

Anyway, let's just say this issue is closed. ;-)

comment:20 by anonymous, 18 years ago

Resolution: worksforme
Status: closedreopened

The problem still persists in 0.10.3.1.

in reply to:  20 ; comment:21 by Christian Boos, 18 years ago

Resolution: worksforme
Status: reopenedclosed

Replying to anonymous:

The problem still persists in 0.10.3.1.

Please understand that we can do nothing based on such report.

  1. make sure you've read the whole ticket, in particular comment:7, and perform the verifications mentioned there
  2. if the problem persist, you might reopen the ticket, with an informative report:
    • what is the actual error message
    • what do you get in the logs at DEBUG_LEVEL (see TracLogging)
    • what is your templates_dir setting in TracIni, and is the report.cs found there any different from the one shipped in 0.10.3.1
    • … anything that could convince us that the problem is with Trac and not on your side

in reply to:  21 comment:22 by anonymous, 18 years ago

Resolution: worksforme
Status: closedreopened

Replying to cboos:

  1. make sure you've read the whole ticket, in particular comment:7, and perform the verifications mentioned there

I have run 'diff' on my report.cs and the report.cs of the official Trac 0.10.3.1 tarball and it's exactly the same.

  1. if the problem persist, you might reopen the ticket, with an informative report:
    • what is the actual error message

I did the following:

  • Click on "View Tickets"
  • Click on Report 8 ("Active tickets, Mine first")
  • Click "Copy Report"
  • Click "Save"
  • Error message: Report execution failed: Report 11 has no SQL query.
  • what do you get in the logs at DEBUG_LEVEL (see TracLogging)

2007-03-12 15:25:05,938 Trac[init] DEBUG: Executing report with SQL " SELECT p.value AS color,

(CASE owner

WHEN
%s THEN 'My Tickets'

ELSE 'Active Tickets'

END) AS group,

id AS ticket, summary, component, version, milestone, t.type AS type,

(CASE status WHEN 'assigned' THEN owner
' *' ELSE owner END) AS owner,

time AS created, changetime AS _changetime, description AS _description, reporter AS _reporter

FROM ticket t, enum p WHERE status IN ('new', 'assigned', 'reopened')

AND p.name = t.priority AND p.type = 'priority'

ORDER BY (owner =
%s) DESC, p.value, milestone, t.type, time

" ([u'user', u'user']

  • what is your templates_dir setting in TracIni, and is the report.cs found there any different from the one shipped in 0.10.3.1

/usr/share/trac/templates, the template dir I'm using.

  • … anything that could convince us that the problem is with Trac and not on your side

Well, this project has been copied from another machine, but I couldn't think of a cause for this error related to its configuration. Other Trac projects on the server are running rock solid.

Hope this helps. :)

comment:23 by Christian Boos, 18 years ago

Actually, when you see - Error message: Report execution failed: Report 11 has no SQL query. in your browser, you should have a corresponding error in your log, with a backtrace. This is what we need to understand the reason for the no SQL query error.

comment:24 by Christian Boos, 18 years ago

Keywords: needinfo added

(set the needinfo tag for checking for feedback from the last person who reopened the ticket)

comment:25 by ThurnerRupert, 17 years ago

marked #5876 as dup …

comment:26 by anonymous, 17 years ago

I am experiencing the same problem on 0.9.3

Is there any more information i can post?

comment:27 by ThurnerRupert, 17 years ago

a sqlite select and the stacktrace as mentioned above. may i suggest you upgrade to 0.10.3?

comment:28 by grant@…, 17 years ago

We are running Dapper and the pre-compiled source is only at 0.9.3, i would like to upgrade to 0.10.3 but last time i tried it broke.

I can't seem to get Trac to log anything?
[logging]
log_file = trac.log
log_level = DEBUG
log_type = file
I have that set in the conf/ of the trac i'm tracing through. Hope thats fine

comment:29 by anonymous, 17 years ago

try putting c:\trac.log for example, then you know where the log file really is.

comment:30 by sid, 17 years ago

Resolution: worksforme
Status: reopenedclosed

Waiting since March of this year for a SQL select statement, and a backtrace error log. Re-closing. Please reopen if you have that info available. Thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.