Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44e7a2a

Browse files
committed
Back-patch into 7.2 branch the 7.3 changes that made contrib/cube
error messages reasonably independent of the bison version used tobuild cubeparse.c. Needed to get this branch passing on buildfarm.
1 parent861e3c7 commit44e7a2a

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

‎contrib/cube/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/contrib/cube/Makefile,v 1.6 2001/11/1616:32:33 petere Exp $
1+
# $Header: /cvsroot/pgsql/contrib/cube/Makefile,v 1.6.2.1 2005/07/1619:27:20 tgl Exp $
22

33
subdir = contrib/cube
44
top_builddir = ../..
@@ -14,11 +14,17 @@ REGRESS = cube
1414

1515
cubeparse.c: cubeparse.h ;
1616

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

‎contrib/cube/cubeparse.y

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
/* NdBox = [(lowerleft),(upperright)]*/
33
/* [(xLL(1)...xLL(N)),(xUR(1)...xUR(n))]*/
44

5-
#defineYYERROR_VERBOSE
65
#defineYYPARSE_PARAM result/* need this to pass a pointer (void *) to yyparse*/
76
#defineYYSTYPEchar *
87
#defineYYDEBUG1
98

10-
#include<string.h>
9+
#include"postgres.h"
10+
1111
#include"cubedata.h"
1212
#include"buffer.h"
1313

14-
#include"postgres.h"
1514
#include"utils/palloc.h"
1615
#include"utils/elog.h"
1716

@@ -164,8 +163,9 @@ int cube_yyerror ( char *msg ) {
164163

165164
position =parse_buffer_pos() >parse_buffer_size() ?parse_buffer_pos() -1 :parse_buffer_pos();
166165

167-
sprintf(
166+
snprintf(
168167
buf,
168+
256,
169169
"%s at or before position %d, character ('%c',\\%03o), input: '%s'\n",
170170
msg,
171171
position,
@@ -175,7 +175,7 @@ int cube_yyerror ( char *msg ) {
175175
);
176176

177177
reset_parse_buffer();
178-
elog(ERROR, buf);
178+
elog(ERROR,"%s",buf);
179179
return0;
180180
}
181181

‎contrib/cube/expected/cube.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SELECT '.1'::cube AS cube;
4141
(1 row)
4242

4343
SELECT '-.1'::cube AS cube;
44-
ERROR: parse error, expecting `FLOAT' or `O_PAREN' or `O_BRACKET' at or before position 2, character ('.', \056), input: '-.1'
44+
ERROR: parse error at or before position 2, character ('.', \056), input: '-.1'
4545

4646
SELECT '1.0'::cube AS cube;
4747
cube
@@ -217,46 +217,46 @@ SELECT '[(0,0,0,0),(1,0,0,0)]'::cube AS cube;
217217
SELECT ''::cube AS cube;
218218
ERROR: cube_in: can't parse an empty string
219219
SELECT 'ABC'::cube AS cube;
220-
ERROR: parse error, expecting `FLOAT' or `O_PAREN' or `O_BRACKET' at or before position 1, character ('A', \101), input: 'ABC'
220+
ERROR: parse error at or before position 1, character ('A', \101), input: 'ABC'
221221

222222
SELECT '()'::cube AS cube;
223-
ERROR: parse error, expecting `FLOAT' at or before position 2, character (')', \051), input: '()'
223+
ERROR: parse error at or before position 2, character (')', \051), input: '()'
224224

225225
SELECT '[]'::cube AS cube;
226-
ERROR: parse error, expecting `O_PAREN' at or before position 2, character (']', \135), input: '[]'
226+
ERROR: parse error at or before position 2, character (']', \135), input: '[]'
227227

228228
SELECT '[()]'::cube AS cube;
229-
ERROR: parse error, expecting `FLOAT' at or before position 3, character (')', \051), input: '[()]'
229+
ERROR: parse error at or before position 3, character (')', \051), input: '[()]'
230230

231231
SELECT '[(1)]'::cube AS cube;
232-
ERROR: parse error, expecting `COMMA' at or before position 5, character (']', \135), input: '[(1)]'
232+
ERROR: parse error at or before position 5, character (']', \135), input: '[(1)]'
233233

234234
SELECT '[(1),]'::cube AS cube;
235-
ERROR: parse error, expecting `O_PAREN' at or before position 6, character (']', \135), input: '[(1),]'
235+
ERROR: parse error at or before position 6, character (']', \135), input: '[(1),]'
236236

237237
SELECT '[(1),2]'::cube AS cube;
238-
ERROR: parse error, expecting `O_PAREN' at or before position 7, character (']', \135), input: '[(1),2]'
238+
ERROR: parse error at or before position 7, character (']', \135), input: '[(1),2]'
239239

240240
SELECT '[(1),(2),(3)]'::cube AS cube;
241-
ERROR: parse error, expecting `C_BRACKET' at or before position 9, character (',', \054), input: '[(1),(2),(3)]'
241+
ERROR: parse error at or before position 9, character (',', \054), input: '[(1),(2),(3)]'
242242

243243
SELECT '1,'::cube AS cube;
244-
ERROR: parse error, expecting `FLOAT' at or before position 2, character (',', \054), input: '1,'
244+
ERROR: parse error at or before position 2, character (',', \054), input: '1,'
245245

246246
SELECT '1,2,'::cube AS cube;
247-
ERROR: parse error, expecting `FLOAT' at or before position 4, character (',', \054), input: '1,2,'
247+
ERROR: parse error at or before position 4, character (',', \054), input: '1,2,'
248248

249249
SELECT '1,,2'::cube AS cube;
250-
ERROR: parse error, expecting `FLOAT' at or before position 3, character (',', \054), input: '1,,2'
250+
ERROR: parse error at or before position 3, character (',', \054), input: '1,,2'
251251

252252
SELECT '(1,)'::cube AS cube;
253-
ERROR: parse error, expecting `FLOAT' at or before position 4, character (')', \051), input: '(1,)'
253+
ERROR: parse error at or before position 4, character (')', \051), input: '(1,)'
254254

255255
SELECT '(1,2,)'::cube AS cube;
256-
ERROR: parse error, expecting `FLOAT' at or before position 6, character (')', \051), input: '(1,2,)'
256+
ERROR: parse error at or before position 6, character (')', \051), input: '(1,2,)'
257257

258258
SELECT '(1,,2)'::cube AS cube;
259-
ERROR: parse error, expecting `FLOAT' at or before position 4, character (',', \054), input: '(1,,2)'
259+
ERROR: parse error at or before position 4, character (',', \054), input: '(1,,2)'
260260

261261
-- invalid input: semantic errors and trailing garbage
262262
SELECT '[(1),(2)],'::cube AS cube; -- 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp