> I am using postgressql 6.5.2. (Please don't tell me to upgrade to 7.0
> because we can't yet).
> I wrote a function, the error I got is
> FATAL 1: btree: cannot split if start (2) >= maxoff (1).
>
> It took me a while to isolate a section of the code. I suspected the line
> was too lone, so I changed it from
>new.problem := new.problem || ''\n'' || ''Asset Owner
> updated: '' || orig_rec.asset_owner || '' -> '' || new.asset_owner;
>
> TO
>
>new.problem := new.problem || ''\n'' || ''Owner updated: ''
> || orig_rec.asset_owner || '' -> '' || new.asset_owner;
>
> After that I was able to submit it through psql.
>
> I continued to work on the second version of the function, got the same
> error again. I decided to reverse to the first version, but when I ran
> the sql file through psql, the same error happens again.
>
> Here is the code:
> **
>
> drop function col_upd_asset() \g
> create function col_upd_asset() returns opaque as '
> DECLARE
> orig_rec record;
>
> BEGIN
> SELECT INTO orig_rec *
> FROM asset
> WHERE case_num = new.case_num;
> IF FOUND THEN
> IF new.asset_owner <> orig_rec.asset_owner THEN
> IF orig_rec.asset_owner ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Owner updated:
> -> '' || new.asset_owner;
> END IF;
> IF new.asset_owner ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Owner updated: ''
> || orig_rec.asset_owner || '' -> '';
> END IF;
> IF new.asset_owner IS NOT NULL AND orig_rec.asset_owner IS NOT
> NULL THEN
>new.problem := new.problem || ''\n'' || ''Owner updated: ''
> || orig_rec.asset_owner || '' -> '' || new.asset_owner;
> END IF;
> END IF;
>
> IF new.short_desc <> orig_rec.short_desc THEN
> IF orig_rec.short_desc ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Hostname updated:
> -> '' || new.short_desc;
> END IF;
> IF new.short_desc ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Hostname updated:
> '' || orig_rec.short_desc || '' -> '';
> END IF;
> IF new.short_desc IS NOT NULL AND orig_rec.short_desc IS NOT
> NULL THEN
>new.problem := new.problem || ''\n'' || ''Hostname updated:
> '' || orig_rec.short_desc || '' -> '' || new.short_desc;
> END IF;
> END IF;
>
> IF new.asset_type <> orig_rec.asset_type THEN
> IF orig_rec.asset_type ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Asset Type
> updated: -> '' || new.asset_type;
> END IF;
> IF new.asset_type ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Asset Type
> updated: '' || orig_rec.asset_type || '' -> '';
> END IF;
> IF new.asset_type IS NOT NULL AND orig_rec.asset_type IS NOT
> NULL THEN
>new.problem := new.problem || ''\n'' || ''Asset Type
> updated: '' || orig_rec.asset_type || '' -> '' || new.asset_type;
> END IF;
> END IF;
>
> IF new.status <> orig_rec.status THEN
> IF orig_rec.status ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Status updated:
> -> '' || new.status;
> END IF;
> IF new.status ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Status updated:
> '' || orig_rec.status || '' -> '';
> END IF;
> IF new.status IS NOT NULL AND orig_rec.status IS NOT NULL THEN
>new.problem := new.problem || ''\n'' || ''Status updated:
> '' || orig_rec.status || '' -> '' || new.status;
> END IF;
> END IF;
>
> IF new.media_type <> orig_rec.media_type THEN
> IF orig_rec.media_type ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Location updated:
> -> '' || new.media_type;
> END IF;
> IF new.media_type ISNULL THEN
>new.problem := new.problem || ''\n'' || ''Location updated:
> '' || orig_rec.media_type || '' -> '';
> END IF;
> IF new.media_type IS NOT NULL AND orig_rec.media_type IS NOT
> NULL THEN
>new.problem := new.problem || ''\n'' || ''Location updated:
> '' || orig_rec.media_type || '' -> '' || new.media_type;
> END IF;
> END IF;
>
> IF new.os_ver <> orig_rec.os_ver THEN
> IF orig_rec.os_ver ISNULL THEN
>new.problem := new.problem || ''\n'' || ''OS Version
> updated: -> '' || new.os_ver;
> END IF;
> IF new.os_ver ISNULL THEN
>new.problem := new.problem || ''\n'' || ''OS Version
> updated: '' || orig_rec.os_ver || '' -> '';
>