Skip site navigation (1) Skip section navigation (2)

Re: Using HStore type in TSearch

From: Łukasz Dejneka <l(dot)dejneka(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using HStore type in TSearch
Date: 2010-03-26 08:15:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Ok, so I did this (modified the ts_match_vq function):
    //get arguments
    HStore *hs = PG_GETARG_HS(0);.
    TSQuery  tq = PG_GETARG_TSQUERY(1);
    TSQuery  tq_in;
    CHKVAL  chkvalKeys;
    bool  res;

    //check for empty values.
    if (!hs->size || !tq->size)
          PG_FREE_IF_COPY(hs, 0);
          PG_FREE_IF_COPY(tq, 1);

    //process TSQuery
    tq_in = TSQueryGetDatum(tq);

    //process HStore
    //HEntry   *ptr = ARRPTR(hs);
    //char   *words = STRPTR(hs);

    chkvalKeys.arrb = ARRPTR(hs);
    chkvalKeys.arre = chkvalKeys.arrb + hs->size;
    chkvalKeys.values = STRPTR(hs);
    chkvalKeys.operand = GETOPERAND(tq_in);

    res = ljd_exec(

    PG_FREE_IF_COPY(hs, 0);
    PG_FREE_IF_COPY(tq, 1);
Now the problem is in the data passed to CHKVAL type (the "chkvalKeys.values
= STRPTR(hs);" line), in TSVector data is ltree (I think), but the HStore
STRPTR function returns a string. How could I convert the HStore values, so
they are compatible with checkcondition_str function located in
/postgresql-8.4.3/contrib/ltree ??

Thanks in advance.

pgsql-novice by date

Next:From: Zdravko BalordaDate: 2010-03-26 10:25:13
Subject: Re: Table inheritance
Previous:From: Tom LaneDate: 2010-03-26 03:40:55
Subject: Re: Getting started

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group