Forum OpenACS Q&A: Response to Weird behavior of db api, doesn't work within ns_sockcallback

The query dispatcher makes some assumptions about how procs using the db api are called, and you've apparently broken one of them.  This is a bit fragile, unfortunately.  You may need to do the same thing that www/index.tcl does: specify the fully qualified query name rather than the relative query name.