Forum OpenACS Q&A: Re: 3.2.5 with 4.6 on same Linux/Postgres install -- delurk

[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: dbinit: error(localhost::blog,ERROR: value too long for type character(1) ): 'select sec_rotate_last_visit(8780, 1047680358)' [14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: Filter sec_read_security_info returned error #1: Database operation "1row" failed (exception NSDB, "Query was not a statement returning rows.") [14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: tclop: invalid return code from filter proc 'Critical filter sec_read_security_info failed.': must be filter_ok, filter_return, or filter_break

Very annoying.... By the way, I do not expect any of you to have a solution for this... I guess we just have to use the old databases on a different install.

Actually, there is a quite simple fix for this problem. In the function sec_rotate_last_visit in security.sql, just cast the variable vtime as a varchar, not a char, thus:

create function sec_rotate_last_visit(integer, integer)
returns integer as '
DECLARE
	v_browser_id alias for $1;
	v_time alias for $2;
BEGIN
    lock table sec_browser_properties;
    delete from sec_browser_properties
        where browser_id = v_browser_id and module = ''acs'' and property_name = ''second_to_last_visit'';
    update sec_browser_properties
        set property_name = ''second_to_last_visit''
        where module = ''acs'' and property_name = ''last_visit'' and browser_id = v_browser_id;
    insert into sec_browser_properties(browser_id, module, property_name, property_value, secure_p)
        values(v_browser_id, ''acs'', ''last_visit'', v_time::varchar, ''f'');

    return 1;
end;
' language 'plpgsql';

Drop the function using PSQL and then read the security.sql file into the database to reload the function. I think all will be happiness and light then.

This actually has been previously discussed at length. See https://openacs.org/forums/message-view?message_id=29185 for one thread...