]> granicus.if.org Git - postgresql/commitdiff
Ensure that in all flex lexers that are part of the backend, a
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 29 May 2003 22:30:02 +0000 (22:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 29 May 2003 22:30:02 +0000 (22:30 +0000)
yy_fatal_error() call results in elog(ERROR) not exit().  This was
already fixed in the main lexer and plpgsql, but extend same technique
to all the other dot-l files.  Also, on review of the possible calls
to yy_fatal_error(), it seems safe to use elog(ERROR) not elog(FATAL).

contrib/cube/cubescan.l
contrib/seg/segscan.l
contrib/tsearch/parser.l
src/backend/bootstrap/bootscanner.l
src/backend/parser/scan.l
src/backend/utils/misc/guc-file.l
src/pl/plpgsql/src/scan.l

index 8367477adb7f035e2b89f7419b5dbd6b218f4d08..1b44397f460e35e7e8a6ea7cfd0cb90717ab377d 100644 (file)
@@ -7,6 +7,9 @@
 
 #include "buffer.h"
 
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
+
 
 /* flex screws a couple symbols when used with the -P option; fix those */
 #define YY_DECL int cube_yylex YY_PROTO(( void )); \
@@ -52,6 +55,5 @@ float        ({integer}|{real})([eE]{integer})?
 int cube_yylex();
 
 void cube_flush_scanner_buffer(void) {
-  fprintf(stderr, "cube_flush_scanner_buffer called\n");
   YY_FLUSH_BUFFER;
 }
index c0962eca8c5bcbbaf23697d3204ce750f3ee22cf..190174d7427be5eabcddfa2689d31c7bea64d529 100644 (file)
@@ -7,6 +7,9 @@
 
 #include "buffer.h"
 
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
+
 
 /* flex screws a couple symbols when used with the -P option; fix those */
 #define YY_DECL int seg_yylex YY_PROTO(( void )); \
index fb34aac7137b34269c355096573dc50c5b332e5e..4323bda7ef003dd269757c38046db07135904986 100644 (file)
@@ -4,6 +4,9 @@
 #include "deflex.h"
 #include "parser.h"
 
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
+
 /* postgres allocation function */
 #define free    pfree
 #define malloc  palloc
index f0c1027c88c66892999a56915976d22d6bff2997..fbb104c18a14e1be9c1c4da36519935c61ca7c3f 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.27 2002/11/04 14:22:32 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.28 2003/05/29 22:30:01 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 /* #include "bootstrap_tokens.h" */
 
 
-int            yyline;  /* keep track of the line number for error reporting */
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
+
+
+static int     yyline;  /* keep track of the line number for error reporting */
 
 %}
 
index 6cb5972b2f668acfd49b639fb807ed33164c6b51..083c19e650c390a23f816ee70e1419c5560c7720 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.106 2003/05/29 20:40:36 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.107 2003/05/29 22:30:02 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@
 #define YY_READ_BUF_SIZE 16777216
 
 /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
-#define fprintf(file, fmt, msg)  ereport(FATAL, (errmsg_internal("%s", msg)))
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
 
 extern YYSTYPE yylval;
 
index 3c4601c0fc2292a11ed1570ac042bdeb482037ea..778f003e4d07b0f94da8a67c794498386383297f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.15 2003/05/27 17:49:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.16 2003/05/29 22:30:02 tgl Exp $
  */
 
 %{
@@ -21,6 +21,9 @@
 #include "utils/elog.h"
 #include "utils/guc.h"
 
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
+
 #define CONFIG_FILENAME "postgresql.conf"
 
 static unsigned ConfigFileLineno;
index 5f7e162f08e08f1293a39a0409b105b52e8cc02e..e6614bf81008520659f4dac8c86db6e1f8726232 100644 (file)
@@ -4,7 +4,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.25 2003/05/05 16:46:28 tgl Exp $
+ *    $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.26 2003/05/29 22:30:02 tgl Exp $
  *
  *    This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -43,7 +43,7 @@
 #define YY_READ_BUF_SIZE 16777216
 
 /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
-#define fprintf(file, fmt, msg)  ereport(FATAL, (errmsg_internal("%s", msg)))
+#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
 
 /* Handles to the buffer that the lexer uses internally */
 static YY_BUFFER_STATE scanbufhandle;