Forum OpenACS Q&A: undefined variable clob_answer

Posted by bill kellerman on
redhat linux 7.3
aolserver 4beta10
postgresql 7.3.4
oacs 4.6.3

Installed simple survey module, created a survey.  On submittal of survey answers, I get a thanks message -- but it never gets saved into the database.  Checking the error log I get this:

"[30/Sep/2003:23:36:03][7425.4101][-conn:oacs::1] Error: Aborting transaction due to error:
undefined variable `clob_answer'"

I found this bug report on another oacs site at, but it is so far unresolved.  Anybody happen to know what is going on?

Posted by bill kellerman on
looks like i solved the problem myself.  yay!

in /web/oacs/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl, checking the comments within proc_doc db_dbml { ... } :

db_with_handle db {
            # another ugly hack to avoid munging tcl files.
            # __lob_id needs to be set inside of a query (.xql) file for this
            # to work.  Say for example that you need to create a lob. In
            # Oracle, you would do something like:

            # db_dml update_photo  "update foo set bar = empty_blob()
            #                      where bar = :bar
            #                      returning foo into :1" -blob_files [list $file]
            # for postgresql we can do the equivalent by placing the following
            # in a query file:
            # update foo set bar = [set __lob_id [db_string get_id "select empty_lob()"]]
            # where bar = :bar

so then i found /web/oacs/packages/simple-survey/process-request-postgresql.xql and changed the following empty_lob() value to [set __lob_id [db_string get_id "select empty_lob()"]]:

<fullquery name="survsimp_question_response_text_insert">

      insert into survsimp_question_responses
      (response_id, question_id, clob_answer)
      (:response_id, :question_id, [set __lob_id [db_string get_id "select empty_lob()"]])


Answers now seem to be submitting properly.  Is the db_dml suggestion the best fix?  I've used simple-survey in the past with no problems.  I am using a newer version of postgresql, but it seems more an issue of the tcl laying around the procs.  If that is the case, shouldn't others be having the same problem?  And could this be a permanent fix if justified?