Thread: Searching Large Objects

Searching Large Objects

From
Dirk Elmendorf
Date:
I need some advice regarding large objects.

I have a table

create table  text_table
(
      data text,
      full_data oid
)

I want to put text blocks into the table.  If the text block is <8k then I
simply

insert into text_table values('text block',0);

if the text_block>8k then  I create a large object and put the oid in the
full_data entry
insert into text_table values('',lo_oid);

The problem is that when I want to search the text blocks I  can only use
the select to search the data column.  I need a way to search both the data
column and the large objects for a sub string.  Does anyone have any ideas
on the best way to search both data and full_data?  I was waiting until 6.4
to see if the 8k limit was going to be lifted but judging by the discussion
on the Hackers list that won't happen until 6.5 at the earliest.   I
thought about trying to build a special function, but I just recently
started using Large Objects and am still a little unsure how they work.

Any help would be greatly appreciated.