Forum OpenACS Q&A: Postgres Functions only work in PSQL, not through aolserver

I cannot seem to get Aolserver to return the correct values with
postgres and its functions.  If I do a query like

"select initcap(first_name), initcap(last_name) from sometablename"

the correct values(initcapped) are returned when I am in psql.
But when I am try to get the results through aolserver, I only get
the values as they are in the postgres database without running it
through its function.

Anyone have any ideas?
Help?
Thanks,
Hao.

I have no idea at all - OpenACS does this all the time and it works.
The postgres driver for AOLserver calls exactly the same client
library that PSQL uses to talk to the database.

It's user error of some sort, but I don't have any idea offhand what
you might be doing to cause this behavior.

Can you post your datamodel and .tcl script?

How are you getting the results of these queries? If you are using the popular "set_variables_after_query", then you need to rephrase your query to give the function calls names.

For example:

set db [ns_db gethandle]

set selection [ns_db 1row $db "SELECT initcap(first_name) as cap_first_name, 
initcat(last_name) as cap_last_name 
from  sometable"]

set_variables_after_query
ns_write "$cap_first_name $cap_last_name"
If you don't give them names, it set_variables_after_query will give them different names.