Forum OpenACS Q&A: Modified bookmark query

Collapse
5: Modified bookmark query (response to 1)
Posted by John MacArthur on
I'm sure someone much brighter than I is working on the bookmarks issues, but to get it working (the index page anyway) I converted the bookmark_query statement in /bookmarks/index.tcl from an outer join to a union. The order by is different here as well as PG doesn't support '||' for varchars (?). If this has already been done I couldn't find in the CVS.

select
    bl1.bookmark_id,
    bl1.url_id,
    coalesce (bl1.local_title, bu1.url_title) as bookmark_title,
    bl1.hidden_p,
    bu1.complete_url,
    bu1.last_live_date,
    bu1.last_checked_date,
    bl1.folder_p,
    bl1.closed_p,
    length (bl1.parent_sort_key) * 8 as indent_width
from
    bm_list bl1, bm_urls bu1
where
    bl1.url_id = bu1.url_id
    and owner_id = 3
    and in_closed_p = 'f'
union all
select
    bl2.bookmark_id,
    bl2.url_id,
    bl2.local_title as bookmark_title,
    bl2.hidden_p,
    null as complete_url,
    null as last_live_date,
    null as last_checked_date,
    bl2.folder_p,
    bl2.closed_p,
    length (bl2.parent_sort_key) * 8 as indent_width
from
    bm_list bl2
where
    bl2.url_id not in
        (select url_id from bm_urls bu2)
    and owner_id = 3
    and in_closed_p = 'f'
order by
    parent_sort_key, local_sort_key
;