Thread: Tsearch1 problem

Tsearch1 problem

From
Rajesh Kumar Mallah
Date:

Greetings,

The function txt2txtidx of tsearch1 crashes the backend
in my installation when it is called with a text where '-'  is
immediately followed by a number.

Does any one has any solution for it?

Regds
Mallah.



tradein_clients=# SELECT version();
+-----------------------------------------------------------+
|                          version                          |
+-----------------------------------------------------------+
| PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96 |
+-----------------------------------------------------------+
(1 row)

Time: 0.61 ms
tradein_clients=# SELECT txt2txtidx('Hello');
+------------+
| txt2txtidx |
+------------+
| 'hello'    |
+------------+
(1 row)

Time: 0.72 ms
tradein_clients=# SELECT txt2txtidx('Hello A');
+------------+
| txt2txtidx |
+------------+
| 'hello'    |
+------------+
(1 row)

Time: 0.72 ms
tradein_clients=# SELECT txt2txtidx('Hello A-');
+------------+
| txt2txtidx |
+------------+
| 'hello'    |
+------------+
(1 row)

Time: 0.64 ms
tradein_clients=# SELECT txt2txtidx('Hello A-A');
+---------------+
|  txt2txtidx   |
+---------------+
| 'a-a' 'hello' |
+---------------+
(1 row)

Time: 0.92 ms
tradein_clients=# SELECT txt2txtidx('Hello A-1');
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#

Re: Tsearch1 problem

From
Oleg Bartunov
Date:
On Tue, 24 Feb 2004, Rajesh Kumar Mallah wrote:

>
> Greetings,
>
> The function txt2txtidx of tsearch1 crashes the backend
> in my installation when it is called with a text where '-'  is
> immediately followed by a number.

example, please. Cut'n paste from psql console would be fine.
Also, what's version of postgresql ?

>
> Does any one has any solution for it?
>
> Regds
> Mallah.
>
>
>
> tradein_clients=# SELECT version();
> +-----------------------------------------------------------+
> |                          version                          |
> +-----------------------------------------------------------+
> | PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96 |
> +-----------------------------------------------------------+
> (1 row)
>
> Time: 0.61 ms
> tradein_clients=# SELECT txt2txtidx('Hello');
> +------------+
> | txt2txtidx |
> +------------+
> | 'hello'    |
> +------------+
> (1 row)
>
> Time: 0.72 ms
> tradein_clients=# SELECT txt2txtidx('Hello A');
> +------------+
> | txt2txtidx |
> +------------+
> | 'hello'    |
> +------------+
> (1 row)
>
> Time: 0.72 ms
> tradein_clients=# SELECT txt2txtidx('Hello A-');
> +------------+
> | txt2txtidx |
> +------------+
> | 'hello'    |
> +------------+
> (1 row)
>
> Time: 0.64 ms
> tradein_clients=# SELECT txt2txtidx('Hello A-A');
> +---------------+
> |  txt2txtidx   |
> +---------------+
> | 'a-a' 'hello' |
> +---------------+
> (1 row)
>
> Time: 0.92 ms
> tradein_clients=# SELECT txt2txtidx('Hello A-1');
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> !#
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Re: Tsearch1 problem

From
Sam Barnett-Cormack
Date:
On Tue, 24 Feb 2004, Oleg Bartunov wrote:

> On Tue, 24 Feb 2004, Rajesh Kumar Mallah wrote:
>
> >
> > Greetings,
> >
> > The function txt2txtidx of tsearch1 crashes the backend
> > in my installation when it is called with a text where '-'  is
> > immediately followed by a number.
>
> example, please. Cut'n paste from psql console would be fine.
> Also, what's version of postgresql ?

That would be what's below.

> > Does any one has any solution for it?
> >
> > Regds
> > Mallah.
> >
> >
> >
> > tradein_clients=# SELECT version();
> > +-----------------------------------------------------------+
> > |                          version                          |
> > +-----------------------------------------------------------+
> > | PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96 |
> > +-----------------------------------------------------------+
> > (1 row)
> >
> > Time: 0.61 ms
> > tradein_clients=# SELECT txt2txtidx('Hello');
> > +------------+
> > | txt2txtidx |
> > +------------+
> > | 'hello'    |
> > +------------+
> > (1 row)
> >
> > Time: 0.72 ms
> > tradein_clients=# SELECT txt2txtidx('Hello A');
> > +------------+
> > | txt2txtidx |
> > +------------+
> > | 'hello'    |
> > +------------+
> > (1 row)
> >
> > Time: 0.72 ms
> > tradein_clients=# SELECT txt2txtidx('Hello A-');
> > +------------+
> > | txt2txtidx |
> > +------------+
> > | 'hello'    |
> > +------------+
> > (1 row)
> >
> > Time: 0.64 ms
> > tradein_clients=# SELECT txt2txtidx('Hello A-A');
> > +---------------+
> > |  txt2txtidx   |
> > +---------------+
> > | 'a-a' 'hello' |
> > +---------------+
> > (1 row)
> >
> > Time: 0.92 ms
> > tradein_clients=# SELECT txt2txtidx('Hello A-1');
> > server closed the connection unexpectedly
> >         This probably means the server terminated abnormally
> >         before or while processing the request.
> > The connection to the server was lost. Attempting reset: Failed.
> > !#
> >
>
>     Regards,
>         Oleg
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--

Sam Barnett-Cormack
Software Developer                           |  Student of Physics & Maths
UK Mirror Service (http://www.mirror.ac.uk)  |  Lancaster University

Re: Tsearch1 problem

From
Oleg Bartunov
Date:
On Tue, 24 Feb 2004, Sam Barnett-Cormack wrote:

> On Tue, 24 Feb 2004, Oleg Bartunov wrote:
>
> > On Tue, 24 Feb 2004, Rajesh Kumar Mallah wrote:
> >
> > >
> > > Greetings,
> > >
> > > The function txt2txtidx of tsearch1 crashes the backend
> > > in my installation when it is called with a text where '-'  is
> > > immediately followed by a number.
> >
> > example, please. Cut'n paste from psql console would be fine.
> > Also, what's version of postgresql ?
>
> That would be what's below.
>

Ah, sorry :)  Just tested on 7.4 and it works fine (as expected).

qq=# select version();
                                version
------------------------------------------------------------------------
 PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2
(1 row)
qq=# SELECT txt2txtidx('Hello A-1');
    txt2txtidx
-------------------
 '1' 'a-1' 'hello'

Also, I run test on 7.3.3

qq=# select version();
                            version
---------------------------------------------------------------
 PostgreSQL 7.3.3 on i686-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)

qq=# SELECT txt2txtidx('Hello A-1');
    txt2txtidx
-------------------
 '1' 'a-1' 'hello'
(1 row)

Everything  is ok.

I see your version of postgresql is outdated (you may upgrade at least
to 7.3.5 !) and most suspicious is the version of your compiler 2.96 !
I don't remember 2.96 was officially released ! I'd recommend to think twice
about your compiler. Don't know if postgresql supports unoffical releases.


    Oleg



> > > Does any one has any solution for it?
> > >
> > > Regds
> > > Mallah.
> > >
> > >
> > >
> > > tradein_clients=# SELECT version();
> > > +-----------------------------------------------------------+
> > > |                          version                          |
> > > +-----------------------------------------------------------+
> > > | PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96 |
> > > +-----------------------------------------------------------+
> > > (1 row)
> > >
> > > Time: 0.61 ms
> > > tradein_clients=# SELECT txt2txtidx('Hello');
> > > +------------+
> > > | txt2txtidx |
> > > +------------+
> > > | 'hello'    |
> > > +------------+
> > > (1 row)
> > >
> > > Time: 0.72 ms
> > > tradein_clients=# SELECT txt2txtidx('Hello A');
> > > +------------+
> > > | txt2txtidx |
> > > +------------+
> > > | 'hello'    |
> > > +------------+
> > > (1 row)
> > >
> > > Time: 0.72 ms
> > > tradein_clients=# SELECT txt2txtidx('Hello A-');
> > > +------------+
> > > | txt2txtidx |
> > > +------------+
> > > | 'hello'    |
> > > +------------+
> > > (1 row)
> > >
> > > Time: 0.64 ms
> > > tradein_clients=# SELECT txt2txtidx('Hello A-A');
> > > +---------------+
> > > |  txt2txtidx   |
> > > +---------------+
> > > | 'a-a' 'hello' |
> > > +---------------+
> > > (1 row)
> > >
> > > Time: 0.92 ms
> > > tradein_clients=# SELECT txt2txtidx('Hello A-1');
> > > server closed the connection unexpectedly
> > >         This probably means the server terminated abnormally
> > >         before or while processing the request.
> > > The connection to the server was lost. Attempting reset: Failed.
> > > !#
> > >
> >
> >     Regards,
> >         Oleg
> > _____________________________________________________________
> > Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> > Sternberg Astronomical Institute, Moscow University (Russia)
> > Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> > phone: +007(095)939-16-83, +007(095)939-23-83
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> >
>
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Re: Tsearch1 problem

From
"Donald Fraser"
Date:

----- Original Message -----
From: "Oleg Bartunov" <oleg@sai.msu.su>
To: "Sam Barnett-Cormack" <s.barnett-cormack@lancaster.ac.uk>
Cc: "Rajesh Kumar Mallah" <mallah@trade-india.com>;
<pgsql-admin@postgresql.org>

<snip,snip>
> I see your version of postgresql is outdated (you may upgrade at least
> to 7.3.5 !) and most suspicious is the version of your compiler 2.96 !
> I don't remember 2.96 was officially released ! I'd recommend to think twice
> about your compiler. Don't know if postgresql supports unoffical releases.
>

2.96 is an official release under Redhat
Linux version 2.4.7-10 (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98))
#1 Thu Sep 6 17:27:27 EDT 2001

I am also using postgres 7.3.4, but unfortunatley I am using tsearch2 so I
cannot run the same tests.

Donald Fraser


Re: Tsearch1 problem

From
Tom Lane
Date:
Oleg Bartunov <oleg@sai.msu.su> writes:
> Also, I run test on 7.3.3
> Everything  is ok.
> I see your version of postgresql is outdated (you may upgrade at least
> to 7.3.5 !) and most suspicious is the version of your compiler 2.96 !

There was at least one post-7.3 bug fix in tsearch, according to the CVS
logs.  Could this be it?

2002-12-06 00:15  momjian

    * contrib/tsearch/morph.c (REL7_3_STABLE): Thank you very much, you
    catch it :). This bug had a long life, because it exists if and
    only if locale of postmaster was a different from C (or
    ru_RU.KOI8-R).

    Please, apply patch for current CVS & 7.3.1

    Magnus Naeslund(f) wrote:
    > Ok, I nailed the bug, but i'm not sure what the correct fix is.
    > Attached tsearch_morph.diff that remedies this problem by
    avoiding it.
    > Also there's a debug aid patch if someone would like to know how
    i
    > finally found it out :)
    >
    > There problem in the lemmatize() function is that GETDICT(...)
    returned
    > a value not handled (BYLOCALE).
    > The value (-1) and later used as an index into the dicts[] array.
    > After that everything went berserk stack went crazy somehow so
    trapping
    > the fault sent me to the wrong place, and every time i read the
    value it
    > was positive ;)
    >
    > So now i just return the initial word passed to the lemmatize
    function,
    > because i don't know what to do with it.

    Magnus Naeslund

            regards, tom lane

Re: Tsearch1 problem

From
Oleg Bartunov
Date:
On Tue, 24 Feb 2004, Tom Lane wrote:

> Oleg Bartunov <oleg@sai.msu.su> writes:
> > Also, I run test on 7.3.3
> > Everything  is ok.
> > I see your version of postgresql is outdated (you may upgrade at least
> > to 7.3.5 !) and most suspicious is the version of your compiler 2.96 !
>
> There was at least one post-7.3 bug fix in tsearch, according to the CVS
> logs.  Could this be it?

Most probable  !


>
> 2002-12-06 00:15  momjian
>
>     * contrib/tsearch/morph.c (REL7_3_STABLE): Thank you very much, you
>     catch it :). This bug had a long life, because it exists if and
>     only if locale of postmaster was a different from C (or
>     ru_RU.KOI8-R).
>
>     Please, apply patch for current CVS & 7.3.1
>
>     Magnus Naeslund(f) wrote:
>     > Ok, I nailed the bug, but i'm not sure what the correct fix is.
>     > Attached tsearch_morph.diff that remedies this problem by
>     avoiding it.
>     > Also there's a debug aid patch if someone would like to know how
>     i
>     > finally found it out :)
>     >
>     > There problem in the lemmatize() function is that GETDICT(...)
>     returned
>     > a value not handled (BYLOCALE).
>     > The value (-1) and later used as an index into the dicts[] array.
>     > After that everything went berserk stack went crazy somehow so
>     trapping
>     > the fault sent me to the wrong place, and every time i read the
>     value it
>     > was positive ;)
>     >
>     > So now i just return the initial word passed to the lemmatize
>     function,
>     > because i don't know what to do with it.
>
>     Magnus Naeslund
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83