Thread: Still a NOTICE in dict_thesaurus.c

Still a NOTICE in dict_thesaurus.c

From
Tom Lane
Date:
Wasn't this patch
http://archives.postgresql.org/pgsql-committers/2007-11/msg00170.php
supposed to fix things so that we wouldn't be throwing NOTICEs out of
tsearch dictionary init functions?  It seems to have gotten only
one of the two elog(NOTICE) calls in there.  The other one is for a
stopword in the replacement phrase.  Is there any objection to making
that an ERROR too?

Also, several of the elog's in this file ought to be ereport's since
they are user-caused error conditions.  I think we are nominally past
string freeze, but does anyone have an objection to changing them to
ereport's?  If they don't get translated, the worst that will happen
is that they come out in English, which is what's happening now.
        regards, tom lane


Re: Still a NOTICE in dict_thesaurus.c

From
Bruce Momjian
Date:
Thanks, working on this now.  Because the stop words can be any stop
word I didn't imagine it could be in the subsitution.  What stop word
will it use?  Anyway, coding it now to match the left-hand-side.

---------------------------------------------------------------------------

Tom Lane wrote:
> Wasn't this patch
> http://archives.postgresql.org/pgsql-committers/2007-11/msg00170.php
> supposed to fix things so that we wouldn't be throwing NOTICEs out of
> tsearch dictionary init functions?  It seems to have gotten only
> one of the two elog(NOTICE) calls in there.  The other one is for a
> stopword in the replacement phrase.  Is there any objection to making
> that an ERROR too?
> 
> Also, several of the elog's in this file ought to be ereport's since
> they are user-caused error conditions.  I think we are nominally past
> string freeze, but does anyone have an objection to changing them to
> ereport's?  If they don't get translated, the worst that will happen
> is that they come out in English, which is what's happening now.
> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Still a NOTICE in dict_thesaurus.c

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> Thanks, working on this now.  Because the stop words can be any stop
> word I didn't imagine it could be in the subsitution.  What stop word
> will it use?  Anyway, coding it now to match the left-hand-side.

Why would you do that?  There is not any corresponding idea of leaving
holes in the pattern.  AFAICS the only change needed is NOTICE->ERROR.
        regards, tom lane


Re: Still a NOTICE in dict_thesaurus.c

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Thanks, working on this now.  Because the stop words can be any stop
> > word I didn't imagine it could be in the subsitution.  What stop word
> > will it use?  Anyway, coding it now to match the left-hand-side.
> 
> Why would you do that?  There is not any corresponding idea of leaving
> holes in the pattern.  AFAICS the only change needed is NOTICE->ERROR.

OK, I see now.  The right-hand side just ignores a stop word, rather
than accepting any stop word.  Got it.

So, for the left-hand-side we have '?' as any stop word and a stop word
as an error, and you want to make a stop word as an error on the
right-hand-size.  No need for '?'.  Agreed.  Want me to do it?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Still a NOTICE in dict_thesaurus.c

From
Bruce Momjian
Date:
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > Thanks, working on this now.  Because the stop words can be any stop
> > > word I didn't imagine it could be in the subsitution.  What stop word
> > > will it use?  Anyway, coding it now to match the left-hand-side.
> >
> > Why would you do that?  There is not any corresponding idea of leaving
> > holes in the pattern.  AFAICS the only change needed is NOTICE->ERROR.
>
> OK, I see now.  The right-hand side just ignores a stop word, rather
> than accepting any stop word.  Got it.
>
> So, for the left-hand-side we have '?' as any stop word and a stop word
> as an error, and you want to make a stop word as an error on the
> right-hand-size.  No need for '?'.  Agreed.  Want me to do it?

I have applied the attached patch to change the NOTICE to ERROR.  Thanks
for spotting this.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/tsearch/dict_thesaurus.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tsearch/dict_thesaurus.c,v
retrieving revision 1.8
diff -c -c -r1.8 dict_thesaurus.c
*** src/backend/tsearch/dict_thesaurus.c    15 Nov 2007 22:25:16 -0000    1.8
--- src/backend/tsearch/dict_thesaurus.c    28 Nov 2007 04:22:08 -0000
***************
*** 570,576 ****
              }
              else if (lexized)
              {
!                 elog(NOTICE, "thesaurus word \"%s\" in substitution is a stop-word, ignored (rule %d)",
inptr->lexeme,i + 1); 
              }
              else
              {
--- 570,576 ----
              }
              else if (lexized)
              {
!                 elog(ERROR, "thesaurus word \"%s\" in substitution is a stop-word (rule %d)", inptr->lexeme, i + 1);
              }
              else
              {

Re: Still a NOTICE in dict_thesaurus.c

From
Alvaro Herrera
Date:
Bruce Momjian wrote:

> I have applied the attached patch to change the NOTICE to ERROR.  Thanks
> for spotting this.

FYI, at this time only the German and French translations have been
updated almost fully, and none of them is yet 100% in the backend
translation.  I think it's appropriate to mark this string for
translation at this time (i.e. turn it into an ereport call).

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)


Re: Still a NOTICE in dict_thesaurus.c

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> FYI, at this time only the German and French translations have been
> updated almost fully, and none of them is yet 100% in the backend
> translation.  I think it's appropriate to mark this string for
> translation at this time (i.e. turn it into an ereport call).

Yeah, I saw a number of elogs that should be ereports in the tsearch
code during some idle looking yesterday.  I'm planning to go through
it a bit more systematically today and fix what needs fixing.
        regards, tom lane