Fix oversight in pts_error_callback() - Mailing list pgsql-patches

From Qingqing Zhou
Subject Fix oversight in pts_error_callback()
Date
Msg-id dd9gld$2e0u$1@news.hub.org
Whole thread Raw
Responses Re: Fix oversight in pts_error_callback()
List pgsql-patches
Since we will invoke callback functions unconditionally in errfinish(), so
pts_error_callback() should not report "invalid type name" without checking
current error status.

Regards,
Qingqing


Index: src/backend/parser/parse_type.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/parse_type.c,v
retrieving revision 1.76
diff -c -r1.76 parse_type.c
*** src/backend/parser/parse_type.c     1 Aug 2005 20:31:10 -0000       1.76
--- src/backend/parser/parse_type.c     9 Aug 2005 05:53:08 -0000
***************
*** 359,373 ****
  pts_error_callback(void *arg)
  {
        const char *str = (const char *) arg;
!
!       errcontext("invalid type name \"%s\"", str);

        /*
         * Currently we just suppress any syntax error position report,
rather
         * than transforming to an "internal query" error.      It's
unlikely that
         * a type name is complex enough to need positioning.
         */
!       errposition(0);
  }

  /*
--- 359,379 ----
  pts_error_callback(void *arg)
  {
        const char *str = (const char *) arg;
!       int     syntaxerrposition;

        /*
         * Currently we just suppress any syntax error position report,
rather
         * than transforming to an "internal query" error.      It's
unlikely that
         * a type name is complex enough to need positioning.
         */
!       syntaxerrposition = geterrposition();
!       if (syntaxerrposition > 0)
!       {
!               errcontext("invalid type name \"%s\"", str);
!               errposition(0);
!       }
!       else
!               errcontext("parse type string \"%s\"", str);
  }

  /*



pgsql-patches by date:

Previous
From: yuanjia lee
Date:
Subject: Allow WAL information to recover corrupted pg_controldata patch
Next
From: Tom Lane
Date:
Subject: Re: Fix oversight in pts_error_callback()