Forum OpenACS Development: What is the problem with this insert statement?

OK. We are debugging the xql files and I have hit a brick wall in relation to a function that attempts to insert some info into a table. I am getting an error that doesnt really tell me what to look at. The error message is that:
Error: Ns_PgExec: result status: 7 message: ERROR:  parser: parse
error at or near "$1"
Now best as I can see, after ocuntless hours trying to debug, I am fairly sure that the problem is in the following section of code, which lies in a function.
    insert into cr_wp_presentations
    (
        presentation_id,
        pres_title, 
        page_signature,
        copyright_notice,
        style,
        public_p,
        show_modified_p
    ) values (
        v_revision_id,
        pres_title,
        page_signature, 
        copyright_notice,
        style,
        public_p,
        show_modified_p
    );

I have tried doing this section within an ''execute'' command. But this doesnt work either. I was hoping someone might have come across this problem already? Thanks alot Jack
Collapse
Posted by Don Baccus on
Parameter 1 ("$1") has been aliased with the same name as one of the columns in your table.  PL/pgSQL doesn't know about context, and is substituting "$1" for that parameter alias reasoanbly enough, resulting in something like

"insert into cr_wp_presentations($1, ...)"

instead of the column name.

You can avoid problems like this by consistently prefixing your parameter aliases with "p_" just as you've used "v_" as a prefix for your variable names.