mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
Back-patch into 7.2 branch the 7.3 changes that made contrib/cube
error messages reasonably independent of the bison version used to build cubeparse.c. Needed to get this branch passing on buildfarm.
This commit is contained in:
parent
861e3c7a07
commit
44e7a2ae60
@ -1,4 +1,4 @@
|
||||
# $Header: /cvsroot/pgsql/contrib/cube/Makefile,v 1.6 2001/11/16 16:32:33 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/contrib/cube/Makefile,v 1.6.2.1 2005/07/16 19:27:20 tgl Exp $
|
||||
|
||||
subdir = contrib/cube
|
||||
top_builddir = ../..
|
||||
@ -14,11 +14,17 @@ REGRESS = cube
|
||||
|
||||
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 $<
|
||||
mv -f y.tab.c cubeparse.c
|
||||
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
|
||||
|
@ -2,16 +2,15 @@
|
||||
/* NdBox = [(lowerleft),(upperright)] */
|
||||
/* [(xLL(1)...xLL(N)),(xUR(1)...xUR(n))] */
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
|
||||
#define YYSTYPE char *
|
||||
#define YYDEBUG 1
|
||||
|
||||
#include <string.h>
|
||||
#include "postgres.h"
|
||||
|
||||
#include "cubedata.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#include "postgres.h"
|
||||
#include "utils/palloc.h"
|
||||
#include "utils/elog.h"
|
||||
|
||||
@ -164,8 +163,9 @@ int cube_yyerror ( char *msg ) {
|
||||
|
||||
position = parse_buffer_pos() > parse_buffer_size() ? parse_buffer_pos() - 1 : parse_buffer_pos();
|
||||
|
||||
sprintf(
|
||||
snprintf(
|
||||
buf,
|
||||
256,
|
||||
"%s at or before position %d, character ('%c', \\%03o), input: '%s'\n",
|
||||
msg,
|
||||
position,
|
||||
@ -175,7 +175,7 @@ int cube_yyerror ( char *msg ) {
|
||||
);
|
||||
|
||||
reset_parse_buffer();
|
||||
elog(ERROR, buf);
|
||||
elog(ERROR, "%s", buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ SELECT '.1'::cube AS cube;
|
||||
(1 row)
|
||||
|
||||
SELECT '-.1'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' or `O_PAREN' or `O_BRACKET' at or before position 2, character ('.', \056), input: '-.1'
|
||||
ERROR: parse error at or before position 2, character ('.', \056), input: '-.1'
|
||||
|
||||
SELECT '1.0'::cube AS cube;
|
||||
cube
|
||||
@ -217,46 +217,46 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube;
|
||||
SELECT ''::cube AS cube;
|
||||
ERROR: cube_in: can't parse an empty string
|
||||
SELECT 'ABC'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' or `O_PAREN' or `O_BRACKET' at or before position 1, character ('A', \101), input: 'ABC'
|
||||
ERROR: parse error at or before position 1, character ('A', \101), input: 'ABC'
|
||||
|
||||
SELECT '()'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 2, character (')', \051), input: '()'
|
||||
ERROR: parse error at or before position 2, character (')', \051), input: '()'
|
||||
|
||||
SELECT '[]'::cube AS cube;
|
||||
ERROR: parse error, expecting `O_PAREN' at or before position 2, character (']', \135), input: '[]'
|
||||
ERROR: parse error at or before position 2, character (']', \135), input: '[]'
|
||||
|
||||
SELECT '[()]'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 3, character (')', \051), input: '[()]'
|
||||
ERROR: parse error at or before position 3, character (')', \051), input: '[()]'
|
||||
|
||||
SELECT '[(1)]'::cube AS cube;
|
||||
ERROR: parse error, expecting `COMMA' at or before position 5, character (']', \135), input: '[(1)]'
|
||||
ERROR: parse error at or before position 5, character (']', \135), input: '[(1)]'
|
||||
|
||||
SELECT '[(1),]'::cube AS cube;
|
||||
ERROR: parse error, expecting `O_PAREN' at or before position 6, character (']', \135), input: '[(1),]'
|
||||
ERROR: parse error at or before position 6, character (']', \135), input: '[(1),]'
|
||||
|
||||
SELECT '[(1),2]'::cube AS cube;
|
||||
ERROR: parse error, expecting `O_PAREN' at or before position 7, character (']', \135), input: '[(1),2]'
|
||||
ERROR: parse error at or before position 7, character (']', \135), input: '[(1),2]'
|
||||
|
||||
SELECT '[(1),(2),(3)]'::cube AS cube;
|
||||
ERROR: parse error, expecting `C_BRACKET' at or before position 9, character (',', \054), input: '[(1),(2),(3)]'
|
||||
ERROR: parse error at or before position 9, character (',', \054), input: '[(1),(2),(3)]'
|
||||
|
||||
SELECT '1,'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 2, character (',', \054), input: '1,'
|
||||
ERROR: parse error at or before position 2, character (',', \054), input: '1,'
|
||||
|
||||
SELECT '1,2,'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 4, character (',', \054), input: '1,2,'
|
||||
ERROR: parse error at or before position 4, character (',', \054), input: '1,2,'
|
||||
|
||||
SELECT '1,,2'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 3, character (',', \054), input: '1,,2'
|
||||
ERROR: parse error at or before position 3, character (',', \054), input: '1,,2'
|
||||
|
||||
SELECT '(1,)'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 4, character (')', \051), input: '(1,)'
|
||||
ERROR: parse error at or before position 4, character (')', \051), input: '(1,)'
|
||||
|
||||
SELECT '(1,2,)'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 6, character (')', \051), input: '(1,2,)'
|
||||
ERROR: parse error at or before position 6, character (')', \051), input: '(1,2,)'
|
||||
|
||||
SELECT '(1,,2)'::cube AS cube;
|
||||
ERROR: parse error, expecting `FLOAT' at or before position 4, character (',', \054), input: '(1,,2)'
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user