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

Commit5666462

Browse files
committed
Ensure that in all flex lexers that are part of the backend, a
yy_fatal_error() call results in elog(ERROR) not exit(). This wasalready fixed in the main lexer and plpgsql, but extend same techniqueto all the other dot-l files. Also, on review of the possible callsto yy_fatal_error(), it seems safe to use elog(ERROR) not elog(FATAL).
1 parent4fb5b92 commit5666462

File tree

7 files changed

+23
-8
lines changed

7 files changed

+23
-8
lines changed

‎contrib/cube/cubescan.l

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include"buffer.h"
99

10+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
11+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
12+
1013

1114
/* flex screws a couple symbols when used with the -P option; fix those*/
1215
#defineYY_DECLint cube_yylexYY_PROTO((void )); \
@@ -52,6 +55,5 @@ float ({integer}|{real})([eE]{integer})?
5255
intcube_yylex();
5356

5457
voidcube_flush_scanner_buffer(void) {
55-
fprintf(stderr,"cube_flush_scanner_buffer called\n");
5658
YY_FLUSH_BUFFER;
5759
}

‎contrib/seg/segscan.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include"buffer.h"
99

10+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
11+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
12+
1013

1114
/* flex screws a couple symbols when used with the -P option; fix those*/
1215
#defineYY_DECLint seg_yylexYY_PROTO((void )); \

‎contrib/tsearch/parser.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include"deflex.h"
55
#include"parser.h"
66

7+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
8+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
9+
710
/* postgres allocation function*/
811
#definefree pfree
912
#definemalloc palloc

‎src/backend/bootstrap/bootscanner.l

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.27 2002/11/04 14:22:32 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.28 2003/05/2922:30:01 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -44,7 +44,11 @@
4444
/* #include "bootstrap_tokens.h"*/
4545

4646

47-
intyyline;/* keep track of the line number for error reporting*/
47+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
48+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
49+
50+
51+
staticintyyline;/* keep track of the line number for error reporting*/
4852

4953
%}
5054

‎src/backend/parser/scan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.106 2003/05/2920:40:36 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.107 2003/05/2922:30:02 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -33,7 +33,7 @@
3333
#defineYY_READ_BUF_SIZE16777216
3434

3535
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
36-
#definefprintf(file, fmt, msg) ereport(FATAL, (errmsg_internal("%s", msg)))
36+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
3737

3838
extern YYSTYPE yylval;
3939

‎src/backend/utils/misc/guc-file.l

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright 2000 by PostgreSQL Global Development Group
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.15 2003/05/27 17:49:46 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.16 2003/05/29 22:30:02 tgl Exp $
88
*/
99

1010
%{
@@ -21,6 +21,9 @@
2121
#include"utils/elog.h"
2222
#include"utils/guc.h"
2323

24+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
25+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
26+
2427
#defineCONFIG_FILENAME"postgresql.conf"
2528

2629
staticunsigned ConfigFileLineno;

‎src/pl/plpgsql/src/scan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.25 2003/05/05 16:46:28 tgl Exp $
7+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.26 2003/05/29 22:30:02 tgl Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -43,7 +43,7 @@
4343
#defineYY_READ_BUF_SIZE16777216
4444

4545
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
46-
#definefprintf(file, fmt, msg) ereport(FATAL, (errmsg_internal("%s", msg)))
46+
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
4747

4848
/* Handles to the buffer that the lexer uses internally*/
4949
static YY_BUFFER_STATE scanbufhandle;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp