Forum OpenACS Q&A: Re: learn to debug an error

Collapse
Posted by Jeff Davis on
Well, first find the function category_synonym::search_sweeper and the corresponding xql file for the tcl file and the query whose name is category_synonym::search_sweeper.delete_old_searches (the function with the query dot the query name). You get that information from the traceback.

The thing thats breaking is that postgres does not know how to subtract 1 from a timestamptz; you can tell which types it knows how to do "-" to via

psql yourserver
\do -
which should list all the "-" operator types.

Looking at that you should see:

   Schema   | Name |        Left arg type        |       Right arg type        |         Result type         |             Description             
------------+------+-----------------------------+-----------------------------+-----------------------------+-------------------------------------
...
 pg_catalog | -    | time with time zone         | interval                    | time with time zone         | minus
which tells you what you need rather than an integer is an interval. So change the 1 to an interval of 1 day in the xql file, and reload changed files for that package at /acs-admin/apm/ and see if that fixes it.
Collapse
Posted by Jeff Davis on
Oh, and to find the function you could either go into /api-doc/ and search for it which should tell you which file it comes from or do something like
grep -r category_synonym::search_sweeper *
in the packages directory.

I guess the real trick is knowing how to read the traceback; in this case you look for the first function down the list which is not in the db API (the db API might have a few bugs but the vast majority of problems like this are in the query itself not in the db API so that's the place to start).