Thread: contrib/tablefunc bugfix

contrib/tablefunc bugfix

From
Joe Conway
Date:
A recent change in the backend exposed a missing include
(lib/stringinfo.h) in contrib/tablefunc. Attached is a fix. Please apply.

I checked and did not find any other contrib libraries affected.

I did find that contrib/cube fails `make installcheck` due to the bison
error message wording change (...syntax error... vs ... parse error
...). It seems contrib/seg was adjusted for this, but cube was not. Is
there a reason for that, or should I send in a patch?

Joe
Index: contrib/tablefunc/tablefunc.c
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/tablefunc/tablefunc.c,v
retrieving revision 1.15
diff -c -r1.15 tablefunc.c
*** contrib/tablefunc/tablefunc.c    27 Mar 2003 16:51:26 -0000    1.15
--- contrib/tablefunc/tablefunc.c    3 May 2003 14:38:00 -0000
***************
*** 31,38 ****

  #include "fmgr.h"
  #include "funcapi.h"
- #include "executor/spi.h"
  #include "miscadmin.h"
  #include "utils/builtins.h"
  #include "utils/guc.h"
  #include "utils/lsyscache.h"
--- 31,39 ----

  #include "fmgr.h"
  #include "funcapi.h"
  #include "miscadmin.h"
+ #include "executor/spi.h"
+ #include "lib/stringinfo.h"
  #include "utils/builtins.h"
  #include "utils/guc.h"
  #include "utils/lsyscache.h"

Re: contrib/tablefunc bugfix

From
Tom Lane
Date:
Joe Conway <mail@joeconway.com> writes:
> I did find that contrib/cube fails `make installcheck` due to the bison
> error message wording change (...syntax error... vs ... parse error
> ...). It seems contrib/seg was adjusted for this, but cube was not. Is
> there a reason for that, or should I send in a patch?

Since we are going to be going through substantial error message wording
changes anyway for 7.4, I'm planning to revert the build-time hack that
preserves the older bison spelling of the error message; we may as
well standardize on the bison 1.875 spelling.  So contrib/seg needs its
hack undone, and both need their expected files updated.  If you wanna
do that, fine, otherwise I'll get to it when I start doing the backend
error call updates.

            regards, tom lane


Re: contrib/tablefunc bugfix

From
Joe Conway
Date:
Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>
>>I did find that contrib/cube fails `make installcheck` due to the bison
>>error message wording change (...syntax error... vs ... parse error
>>...). It seems contrib/seg was adjusted for this, but cube was not. Is
>>there a reason for that, or should I send in a patch?
>
> Since we are going to be going through substantial error message wording
> changes anyway for 7.4, I'm planning to revert the build-time hack that
> preserves the older bison spelling of the error message; we may as
> well standardize on the bison 1.875 spelling.  So contrib/seg needs its
> hack undone, and both need their expected files updated.  If you wanna
> do that, fine, otherwise I'll get to it when I start doing the backend
> error call updates.

OK -- patch attached. Both cube and seg pass `make installcheck` for me now.

Joe
Index: contrib/cube/Makefile
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/cube/Makefile,v
retrieving revision 1.8
diff -c -r1.8 Makefile
*** contrib/cube/Makefile    31 Jan 2003 20:58:00 -0000    1.8
--- contrib/cube/Makefile    4 May 2003 06:07:16 -0000
***************
*** 17,33 ****

  cubeparse.c: cubeparse.h ;

- # The sed hack is so that we can get the same error messages with
- # bison 1.875 and later as we did with earlier bisons.  Eventually,
- # I suppose, we should re-standardize on "syntax error" --- in which
- # case flip the sed translation, but don't remove it.
-
  cubeparse.h: cubeparse.y
  ifdef YACC
      $(YACC) -d $(YFLAGS) -p cube_yy $<
!     sed -e 's/"syntax error/"parse error/' < y.tab.c > cubeparse.c
      mv -f y.tab.h cubeparse.h
-     rm -f y.tab.c
  else
      @$(missing) bison $< $@
  endif
--- 17,27 ----

  cubeparse.c: cubeparse.h ;

  cubeparse.h: cubeparse.y
  ifdef YACC
      $(YACC) -d $(YFLAGS) -p cube_yy $<
!     mv -f y.tab.c cubeparse.c
      mv -f y.tab.h cubeparse.h
  else
      @$(missing) bison $< $@
  endif
Index: contrib/cube/expected/cube.out
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/cube/expected/cube.out,v
retrieving revision 1.10
diff -c -r1.10 cube.out
*** contrib/cube/expected/cube.out    13 Feb 2003 05:26:50 -0000    1.10
--- contrib/cube/expected/cube.out    4 May 2003 06:09:17 -0000
***************
*** 258,303 ****
  SELECT ''::cube AS cube;
  ERROR:  cube_in: can't parse an empty string
  SELECT 'ABC'::cube AS cube;
! ERROR:  syntax error at or before position 1, character ('A', \101), input: 'ABC'

  SELECT '()'::cube AS cube;
! ERROR:  syntax error at or before position 2, character (')', \051), input: '()'

  SELECT '[]'::cube AS cube;
! ERROR:  syntax error at or before position 2, character (']', \135), input: '[]'

  SELECT '[()]'::cube AS cube;
! ERROR:  syntax error at or before position 3, character (')', \051), input: '[()]'

  SELECT '[(1)]'::cube AS cube;
! ERROR:  syntax error at or before position 5, character (']', \135), input: '[(1)]'

  SELECT '[(1),]'::cube AS cube;
! ERROR:  syntax error at or before position 6, character (']', \135), input: '[(1),]'

  SELECT '[(1),2]'::cube AS cube;
! ERROR:  syntax error at or before position 7, character (']', \135), input: '[(1),2]'

  SELECT '[(1),(2),(3)]'::cube AS cube;
! ERROR:  syntax error at or before position 9, character (',', \054), input: '[(1),(2),(3)]'

  SELECT '1,'::cube AS cube;
! ERROR:  syntax error at or before position 2, character (',', \054), input: '1,'

  SELECT '1,2,'::cube AS cube;
! ERROR:  syntax error at or before position 4, character (',', \054), input: '1,2,'

  SELECT '1,,2'::cube AS cube;
! ERROR:  syntax error at or before position 3, character (',', \054), input: '1,,2'

  SELECT '(1,)'::cube AS cube;
! ERROR:  syntax error at or before position 4, character (')', \051), input: '(1,)'

  SELECT '(1,2,)'::cube AS cube;
! ERROR:  syntax error at or before position 6, character (')', \051), input: '(1,2,)'

  SELECT '(1,,2)'::cube AS cube;
! ERROR:  syntax error at or before position 4, character (',', \054), input: '(1,,2)'

  -- invalid input: semantic errors and trailing garbage
  SELECT '[(1),(2)],'::cube AS cube; -- 0
--- 258,303 ----
  SELECT ''::cube AS cube;
  ERROR:  cube_in: can't parse an empty string
  SELECT 'ABC'::cube AS cube;
! ERROR:  parse error at or before position 1, character ('A', \101), input: 'ABC'

  SELECT '()'::cube AS cube;
! ERROR:  parse error at or before position 2, character (')', \051), input: '()'

  SELECT '[]'::cube AS cube;
! ERROR:  parse error at or before position 2, character (']', \135), input: '[]'

  SELECT '[()]'::cube AS cube;
! ERROR:  parse error at or before position 3, character (')', \051), input: '[()]'

  SELECT '[(1)]'::cube AS cube;
! ERROR:  parse error at or before position 5, character (']', \135), input: '[(1)]'

  SELECT '[(1),]'::cube AS cube;
! ERROR:  parse error at or before position 6, character (']', \135), input: '[(1),]'

  SELECT '[(1),2]'::cube AS cube;
! ERROR:  parse error at or before position 7, character (']', \135), input: '[(1),2]'

  SELECT '[(1),(2),(3)]'::cube AS cube;
! ERROR:  parse error at or before position 9, character (',', \054), input: '[(1),(2),(3)]'

  SELECT '1,'::cube AS cube;
! ERROR:  parse error at or before position 2, character (',', \054), input: '1,'

  SELECT '1,2,'::cube AS cube;
! ERROR:  parse error at or before position 4, character (',', \054), input: '1,2,'

  SELECT '1,,2'::cube AS cube;
! ERROR:  parse error at or before position 3, character (',', \054), input: '1,,2'

  SELECT '(1,)'::cube AS cube;
! ERROR:  parse error at or before position 4, character (')', \051), input: '(1,)'

  SELECT '(1,2,)'::cube AS cube;
! ERROR:  parse error at or before position 6, character (')', \051), input: '(1,2,)'

  SELECT '(1,,2)'::cube AS cube;
! ERROR:  parse error at or before position 4, character (',', \054), input: '(1,,2)'

  -- invalid input: semantic errors and trailing garbage
  SELECT '[(1),(2)],'::cube AS cube; -- 0
Index: contrib/seg/Makefile
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/seg/Makefile,v
retrieving revision 1.8
diff -c -r1.8 Makefile
*** contrib/seg/Makefile    31 Jan 2003 20:58:00 -0000    1.8
--- contrib/seg/Makefile    4 May 2003 06:07:35 -0000
***************
*** 16,32 ****

  segparse.c: segparse.h ;

- # The sed hack is so that we can get the same error messages with
- # bison 1.875 and later as we did with earlier bisons.  Eventually,
- # I suppose, we should re-standardize on "syntax error" --- in which
- # case flip the sed translation, but don't remove it.
-
  segparse.h: segparse.y
  ifdef YACC
      $(YACC) -d $(YFLAGS) -p seg_yy $<
!     sed -e 's/"syntax error/"parse error/' < y.tab.c > segparse.c
      mv -f y.tab.h segparse.h
-     rm -f y.tab.c
  else
      @$(missing) bison $< $@
  endif
--- 16,26 ----

  segparse.c: segparse.h ;

  segparse.h: segparse.y
  ifdef YACC
      $(YACC) -d $(YFLAGS) -p seg_yy $<
!     mv -f y.tab.c segparse.c
      mv -f y.tab.h segparse.h
  else
      @$(missing) bison $< $@
  endif

Re: contrib/tablefunc bugfix

From
Tom Lane
Date:
Joe Conway <mail@joeconway.com> writes:
> I did find that contrib/cube fails `make installcheck` due to the bison
> error message wording change (...syntax error... vs ... parse error
> ...). It seems contrib/seg was adjusted for this, but cube was not. Is
> there a reason for that, or should I send in a patch?
>>
>> Since we are going to be going through substantial error message wording
>> changes anyway for 7.4, I'm planning to revert the build-time hack that
>> preserves the older bison spelling of the error message; we may as
>> well standardize on the bison 1.875 spelling.  So contrib/seg needs its
>> hack undone, and both need their expected files updated.  If you wanna
>> do that, fine, otherwise I'll get to it when I start doing the backend
>> error call updates.

> OK -- patch attached. Both cube and seg pass `make installcheck` for me now.

Applied.  contrib passes build, install, installcheck cleanly for me
now.  Let me know if you see remaining problems...

            regards, tom lane

Re: contrib/tablefunc bugfix

From
Tom Lane
Date:
Joe Conway <mail@joeconway.com> writes:
> A recent change in the backend exposed a missing include
> (lib/stringinfo.h) in contrib/tablefunc. Attached is a fix. Please apply.

Done.

            regards, tom lane

Re: contrib/tablefunc bugfix

From
Joe Conway
Date:
Tom Lane wrote:
> Applied.  contrib passes build, install, installcheck cleanly for me
> now.  Let me know if you see remaining problems...
>

Thanks. I just updated to cvs tip and installcheck passes for all 90
backend tests and all contrib as well.

Still getting a number of ecpg related warnings on compile, but I assume
we're not worried too much about those as of yet.

Joe



Re: contrib/tablefunc bugfix

From
Tom Lane
Date:
Joe Conway <mail@joeconway.com> writes:
> Still getting a number of ecpg related warnings on compile, but I assume
> we're not worried too much about those as of yet.

Me too ... I've been starting to think about ragging on Michael about
those.  For starters, C files appearing in src/interfaces ought to
include "postgres_fe.h", rather than a random selection of system
headers.  Several of the warnings I'm getting would go away if
ecpg/pgtypeslib/ were following that basic portability practice.

            regards, tom lane