]> granicus.if.org Git - postgresql/blobdiff - src/include/utils/elog.h
Improve the recently-added support for properly pluralized error messages
[postgresql] / src / include / utils / elog.h
index 982e3b2c6551f240f21217d34c9bc6324b7dca72..81ddb9fc3779fc142de58e1d135fde132d1dadeb 100644 (file)
@@ -4,10 +4,10 @@
  *       POSTGRES error reporting/logging definitions.
  *
  *
- * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.95 2008/10/09 17:24:05 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.100 2009/06/04 18:33:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #define COMMERROR      16                      /* Client communication problems; same as LOG
                                                                 * for server reporting, but never sent to
                                                                 * client. */
-#define INFO           17                      /* Informative messages that are always sent
-                                                                * to client;  is not affected by
-                                                                * client_min_messages */
+#define INFO           17                      /* Messages specifically requested by user
+                                                                * (eg VACUUM VERBOSE output); always sent to
+                                                                * client regardless of client_min_messages,
+                                                                * but by default not sent to server log. */
 #define NOTICE         18                      /* Helpful messages to users about query
-                                                                * operation;  sent to client and server log
+                                                                * operation; sent to client and server log
                                                                 * by default. */
 #define WARNING                19                      /* Warnings.  NOTICE is for expected messages
                                                                 * like implicit sequence creation by SERIAL.
@@ -97,7 +98,7 @@
  * wish to use a different message catalog from the backend's. To avoid having
  * one copy of the default text domain per .o file, we define it as NULL here
  * and have errstart insert the default text domain.  Modules can either use
- * ereport_domain() directly, or preferrably they can override the TEXTDOMAIN
+ * ereport_domain() directly, or preferably they can override the TEXTDOMAIN
  * macro.
  *----------
  */
        (errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain) ? \
         (errfinish rest) : (void) 0)
 
-#define ereport(level, rest)   \
-       ereport_domain(level, TEXTDOMAIN, rest)
+#define ereport(elevel, rest)  \
+       ereport_domain(elevel, TEXTDOMAIN, rest)
 
 #define TEXTDOMAIN NULL
 
@@ -131,6 +132,14 @@ errmsg_internal(const char *fmt,...)
    the supplied arguments. */
 __attribute__((format(printf, 1, 2)));
 
+extern int
+errmsg_plural(const char *fmt_singular, const char *fmt_plural,
+                         unsigned long n, ...)
+/* This extension allows gcc to check the format string for consistency with
+   the supplied arguments. */
+__attribute__((format(printf, 1, 4)))
+__attribute__((format(printf, 2, 4)));
+
 extern int
 errdetail(const char *fmt,...)
 /* This extension allows gcc to check the format string for consistency with
@@ -143,6 +152,14 @@ errdetail_log(const char *fmt,...)
    the supplied arguments. */
 __attribute__((format(printf, 1, 2)));
 
+extern int
+errdetail_plural(const char *fmt_singular, const char *fmt_plural,
+                                unsigned long n, ...)
+/* This extension allows gcc to check the format string for consistency with
+   the supplied arguments. */
+__attribute__((format(printf, 1, 4)))
+__attribute__((format(printf, 2, 4)));
+
 extern int
 errhint(const char *fmt,...)
 /* This extension allows gcc to check the format string for consistency with
@@ -281,7 +298,7 @@ typedef struct ErrorData
        const char *filename;           /* __FILE__ of ereport() call */
        int                     lineno;                 /* __LINE__ of ereport() call */
        const char *funcname;           /* __func__ of ereport() call */
-       const char *domain;                     /* message domain, NULL if default */
+       const char *domain;                     /* message domain */
        int                     sqlerrcode;             /* encoded ERRSTATE */
        char       *message;            /* primary error message */
        char       *detail;                     /* detail error message */
@@ -324,6 +341,7 @@ extern int  Log_destination;
 /* Other exported functions */
 extern void DebugFileOpen(void);
 extern char *unpack_sql_state(int sql_state);
+extern bool in_error_recursion_trouble(void);
 
 #ifdef HAVE_SYSLOG
 extern void set_syslog_parameters(const char *ident, int facility);