Re: Using HStore type in TSearch

Поиск
Список
Период
Сортировка
От Łukasz Dejneka
Тема Re: Using HStore type in TSearch
Дата
Msg-id 4df5da451003260115va8d83d1l43da0367bcf60d88@mail.gmail.com
обсуждение исходный текст
Ответ на Using HStore type in TSearch  (Łukasz Dejneka <l.dejneka@gmail.com>)
Список pgsql-novice
Ok, so I did this (modified the ts_match_vq function):
Datum.
ljd_test(PG_FUNCTION_ARGS).
{
    //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);
          PG_RETURN_BOOL(false);
    }

    //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(
            GETQUERY(tq_in),
            &chkvalKeys,
            true,
            checkcondition_str
                );


    PG_FREE_IF_COPY(hs, 0);
    PG_FREE_IF_COPY(tq, 1);
    PG_RETURN_BOOL(res);
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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Getting started
Следующее
От: Mladen Gogala
Дата:
Сообщение: Re: Table inheritance