Re: Query inside RTF - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Query inside RTF
Date
Msg-id b42b73150910080828u6738774fgcf44e013d21f2e8b@mail.gmail.com
Whole thread Raw
In response to Query inside RTF  ("Leonardo M." Ramé <l.rame@griensu.com>)
Responses Re: Query inside RTF
List pgsql-general
2009/10/8 Leonardo M. <l.rame@griensu.com>:
> Hi, in my database I store RTF files inside a Bytea field. Now a
> customer is requesting a search inside RTF fields and I'm trying to
> implement it by issuing this query:
>
> select
>  *
> from my_table
> where
>  cast(rtf_field as varchar) like '%condition%'
>
> This works ok when the condition doesn't include accented chars. RTF
> escapes accented characters as "\'f1" for í, "\'f3" for ó, and so on.
>
> To escape \ and ', I'd read it shuld be used \\ and '', so I thaugth
> that a like '%diagn\\\\''f3stica%' should get "diagnóstica", but it
> doesn't.
>
> Any hint on this?

first, try dollar quoting:
cast(rtf_field as varchar) like $merlin$%condition%$merlin$

:-)

merlin

pgsql-general by date:

Previous
From: "Massa, Harald Armin"
Date:
Subject: cost of query done - recorded anywhere?
Next
From: "Leonardo M." Ramé
Date:
Subject: Re: Query inside RTF