Forum OpenACS Q&A: AOLserver 3.5.1

Collapse
Posted by Jon Griffin on
It appears that 3.5.1 is seriously hosed.


 Error: Ns_PgExec: result status: 7 message: ERROR:  Function 'decode(int8, int
4, int4, int4)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts

[08/Nov/2002:10:56:38][8281.1024][-main-] Error: Error sourcing /home/jon/web/e88/live/packages/acs-tcl/tcl/security-ini
t.tcl:

This exact setup works fine under 3.5.0. Maybe the nsdb stub is causing this problem?

Collapse
2: Re: AOLserver 3.5.1 (response to 1)
Posted by Dan Wickstrom on
Where is that decode function defined? I have a fresh install of the 4.6 branch, and I don't have a decode function that matches that function signature:

dotlrn=# select decode(count(*),0,0,1) from secret_tokens;
ERROR:  Function 'decode(int8, int4, int4, int4)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts
dotlrn=# select version();
                             version                              
------------------------------------------------------------------
 PostgreSQL 7.2.1 on sparc-sun-solaris2.8, compiled by GCC 2.95.3
(1 row)

dotlrn=# 


Collapse
3: Re: AOLserver 3.5.1 (response to 1)
Posted by Jon Griffin on
security-init.tcl:

# Verify that the secret_tokens table is populated
set secret_tokens_exists [db_string secret_tokens_exists "select decode(count(*),0,0,1) from secret_tokens"]
The strange thing is it works fine from 3.5.0
Collapse
4: Re: AOLserver 3.5.1 (response to 3)
Posted by Jeff Davis on
I think the problem is with nsxml.  It should be picking up
the query in security-init.xql which does not use decode.
Collapse
5: Re: AOLserver 3.5.1 (response to 1)
Posted by Jon Griffin on
That fixed it.

There seems to be 2 versions of nsxml; One from aolserver which I thought scottg updated (which has the problem) and the other was older.

The old ns_xml.c is 39505 bytes
The newer is 62727.

Collapse
6: Re: AOLserver 3.5.1 (response to 2)
Posted by Richard Hamilton on
Dan,
This may be no help to you but I have openacs-4-6 installed and the 'decode' function is present in postgres (\df at psql command line).
I have been looking for some documentation to tell me what it does but have not yet found any.
Regards Richard
Collapse
7: Re: AOLserver 3.5.1 (response to 5)
Posted by Richard Hamilton on
A search for decode in the ACS site search did not reveal anything but google came up with this which is in fact at : http://sdm.openacs.org/doc/openacs/html/oracle-to-pg-porting.html

Decode

Oracle's handy decode function works as follows:
decode(expr, search, expr[, search, expr...] [, default])
To evaluate this expression, Oracle compares expr to each search value one by one. If expr is equal to a search, Oracle returns the corresponding result. If no match is found, Oracle returns default, or, if default is omitted, returns null.
Postgres doesn't have the same construct. It can be replicated with:
CASE WHEN expr THEN expr [...] ELSE expr END
which returns the expression corresponding to the first true predicate.
For example:
CASE WHEN c1 = 1 THEN 'match' ELSE 'no match' END
_______________________________________

I assume that the decode function that has been defined in postgres and that I have mentioned above takes care of the issue? Can anyone confirm that?
Collapse
8: Re: AOLserver 3.5.1 (response to 1)
Posted by Jun Yamog on
Hi Richard,

Not sure if decode was replicated in OACS.  But I do encourage you to use CASE as this works on both PG and Oracle.