postgresql7.1
select message_id,
forum_id,
subject,
content,
person__name(user_id) as user_name,
party__email(user_id) as user_email,
user_id,
forums_forum__name(forum_id) as forum_name,
forums_message__root_message_id(forums_messages.message_id) as root_message_id,
(select subject
from forums_messages fm2
where message_id = forums_message__root_message_id(forums_messages.message_id)) as root_subject,
to_char(posting_date, 'Mon DD YYYY HH24:MI:SS') as posting_date,
tree_sortkey,
parent_id,
state,
html_p
from forums_messages
where message_id= :message_id
declare begin
forums_message__delete_thread(:message_id);
end;
declare begin
forums_message__thread_close(:message_id);
end;
declare begin
forums_message__thread_open(:message_id);
end;