From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Janek Sendrowski <janek12(at)web(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Query on a record variable |
Date: | 2013-08-18 20:28:21 |
Message-ID: | 52112E65.1000403@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 08/18/2013 01:14 PM, Janek Sendrowski wrote:
> Hi,
>
> How can I do a query on a record variable in a function.
> I want to do a dirty fulltextsearch on a table and then choose the string which have a low levenshtein-distance.
> I wanted to it like this, but it doesn't work:
>
> v_query := 'SELECT col FROM table WHERE LENGTH(dede) BETWEEN x AND y AND plainto_tsquery(string') @@ vectors';
> EXECUTE v_query INTO v_rec;
> v_query := 'SELECT levenshtein('string', v_rec.col) AS lev WHERE levenshtein('string', v_rec.col) < 10';
> EXECUTE v_query INTO v_rec2;
>
> Or is there an easier way to do that. Maybe just to do one query at once?
You can't drop the v_rec variable directly into the string. You will
need to concatenate it in. For more info see:
>
> Hope someone can help me.
>
> Janek Sendrowski
>
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tyler Reese | 2013-08-18 23:46:46 | Re: Select performance variation based on the different combinations of using where lower(), order by, and limit |
Previous Message | Janek Sendrowski | 2013-08-18 20:14:43 | Query on a record variable |