Re: Query on a record variable

From: Giuseppe Broccolo <giuseppe(dot)broccolo(at)2ndquadrant(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Query on a record variable
Date: 2013-08-19 10:18:53
Message-ID: 5211F10D.7050701@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Janek,

> Hi,
>
> ok :)

I suppose you have a table 'table' with 'col' (text), 'dede' (text) and
'vectors' (tsvector) as fields. In this case, you can do

SELECT levenshtein(col, 'string') FROM table AS lev WHERE
levenshtein(col, 'string') < 10 AND LENGTH(dede) BETWEEN x AND y AND
plainto_tsquery('string') @@ vectors;

Hope it can help.

Giuseppe.

--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe(dot)broccolo(at)2ndQuadrant(dot)it | www.2ndQuadrant.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Heikki Linnakangas 2013-08-19 11:48:21 Re: [JDBC] Incorrect response code after XA recovery
Previous Message Luca Ferrari 2013-08-19 08:28:19 Re: Denormalized field