summaryrefslogtreecommitdiff
path: root/src/include/common
diff options
context:
space:
mode:
authorTom Lane2025-02-05 17:45:58 +0000
committerTom Lane2025-02-05 17:45:58 +0000
commita14707da564e8c94bd123f0e3a75e194fd7ef56a (patch)
treeea70529d79886ed96a78abbf326857ce363d01b8 /src/include/common
parentee4667f0184d87a2e58822e6a9edad563fa164fd (diff)
Show more-intuitive titles for psql commands \dt, \di, etc.
If exactly one relation type is requested in a command of the \dtisv family, say "tables", "indexes", etc instead of "relations". This should cover the majority of actual uses, without creating a huge number of new translatable strings. The error messages for no matching relations are adjusted as well. In passing, invent "pg_log_error_internal()" to be used for frontend error messages that don't seem to need translation, analogously to errmsg_internal() in the backend. The implementation is a bit cheesy, being just a macro to prevent xgettext from recognizing a trigger keyword. This won't avoid a useless gettext lookup cycle at runtime --- but surely we don't care about an extra microsecond or two in what's supposed to be a can't-happen case. I (tgl) also made "pg_fatal_internal()", though it's not used in this patch. Author: Greg Sabino Mullane <htamfids@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAKAnmm+7o93fQV-RFkGaN1QnP-0D4d3JTykD+cLueqjDMKdfag@mail.gmail.com
Diffstat (limited to 'src/include/common')
-rw-r--r--src/include/common/logging.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/common/logging.h b/src/include/common/logging.h
index 5d8636f75c9..81529ee8f29 100644
--- a/src/include/common/logging.h
+++ b/src/include/common/logging.h
@@ -153,4 +153,11 @@ void pg_log_generic_v(enum pg_log_level level, enum pg_log_part part,
exit(1); \
} while(0)
+/*
+ * Use these variants for "can't happen" cases, if it seems translating their
+ * messages would be a waste of effort.
+ */
+#define pg_log_error_internal(...) pg_log_error(__VA_ARGS__)
+#define pg_fatal_internal(...) pg_fatal(__VA_ARGS__)
+
#endif /* COMMON_LOGGING_H */