aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/backend_status.h12
-rw-r--r--src/include/utils/date.h2
-rw-r--r--src/include/utils/dsa.h1
-rw-r--r--src/include/utils/elog.h2
-rw-r--r--src/include/utils/injection_point.h16
-rw-r--r--src/include/utils/memutils.h82
-rw-r--r--src/include/utils/pg_locale.h54
-rw-r--r--src/include/utils/skipsupport.h2
-rw-r--r--src/include/utils/timestamp.h3
9 files changed, 83 insertions, 91 deletions
diff --git a/src/include/utils/backend_status.h b/src/include/utils/backend_status.h
index 430ccd7d78e..3016501ac05 100644
--- a/src/include/utils/backend_status.h
+++ b/src/include/utils/backend_status.h
@@ -170,10 +170,10 @@ typedef struct PgBackendStatus
int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM];
/* query identifier, optionally computed using post_parse_analyze_hook */
- uint64 st_query_id;
+ int64 st_query_id;
/* plan identifier, optionally computed using planner_hook */
- uint64 st_plan_id;
+ int64 st_plan_id;
} PgBackendStatus;
@@ -321,16 +321,16 @@ extern void pgstat_clear_backend_activity_snapshot(void);
/* Activity reporting functions */
extern void pgstat_report_activity(BackendState state, const char *cmd_str);
-extern void pgstat_report_query_id(uint64 query_id, bool force);
-extern void pgstat_report_plan_id(uint64 plan_id, bool force);
+extern void pgstat_report_query_id(int64 query_id, bool force);
+extern void pgstat_report_plan_id(int64 plan_id, bool force);
extern void pgstat_report_tempfile(size_t filesize);
extern void pgstat_report_appname(const char *appname);
extern void pgstat_report_xact_timestamp(TimestampTz tstamp);
extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser);
extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer,
int buflen);
-extern uint64 pgstat_get_my_query_id(void);
-extern uint64 pgstat_get_my_plan_id(void);
+extern int64 pgstat_get_my_query_id(void);
+extern int64 pgstat_get_my_plan_id(void);
extern BackendType pgstat_get_backend_type_by_proc_number(ProcNumber procNumber);
diff --git a/src/include/utils/date.h b/src/include/utils/date.h
index bb5c1e57b07..abfda0b1ae9 100644
--- a/src/include/utils/date.h
+++ b/src/include/utils/date.h
@@ -100,6 +100,8 @@ extern int32 anytime_typmod_check(bool istz, int32 typmod);
extern double date2timestamp_no_overflow(DateADT dateVal);
extern Timestamp date2timestamp_opt_overflow(DateADT dateVal, int *overflow);
extern TimestampTz date2timestamptz_opt_overflow(DateADT dateVal, int *overflow);
+extern DateADT timestamp2date_opt_overflow(Timestamp timestamp, int *overflow);
+extern DateADT timestamptz2date_opt_overflow(TimestampTz timestamp, int *overflow);
extern int32 date_cmp_timestamp_internal(DateADT dateVal, Timestamp dt2);
extern int32 date_cmp_timestamptz_internal(DateADT dateVal, TimestampTz dt2);
diff --git a/src/include/utils/dsa.h b/src/include/utils/dsa.h
index 9eca8788908..0a6067be628 100644
--- a/src/include/utils/dsa.h
+++ b/src/include/utils/dsa.h
@@ -145,6 +145,7 @@ extern dsa_area *dsa_create_in_place_ext(void *place, size_t size,
size_t init_segment_size,
size_t max_segment_size);
extern dsa_area *dsa_attach(dsa_handle handle);
+extern bool dsa_is_attached(dsa_handle handle);
extern dsa_area *dsa_attach_in_place(void *place, dsm_segment *segment);
extern void dsa_release_in_place(void *place);
extern void dsa_on_dsm_detach_release_in_place(dsm_segment *, Datum);
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 5eac0e16970..675f4f5f469 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -485,7 +485,7 @@ typedef enum
PGERROR_TERSE, /* single-line error messages */
PGERROR_DEFAULT, /* recommended style */
PGERROR_VERBOSE, /* all the facts, ma'am */
-} PGErrorVerbosity;
+} PGErrorVerbosity;
extern PGDLLIMPORT int Log_error_verbosity;
extern PGDLLIMPORT char *Log_line_prefix;
diff --git a/src/include/utils/injection_point.h b/src/include/utils/injection_point.h
index a37958e1835..fd5bc061b7b 100644
--- a/src/include/utils/injection_point.h
+++ b/src/include/utils/injection_point.h
@@ -11,6 +11,19 @@
#ifndef INJECTION_POINT_H
#define INJECTION_POINT_H
+#include "nodes/pg_list.h"
+
+/*
+ * Injection point data, used when retrieving a list of all the attached
+ * injection points.
+ */
+typedef struct InjectionPointData
+{
+ const char *name;
+ const char *library;
+ const char *function;
+} InjectionPointData;
+
/*
* Injection points require --enable-injection-points.
*/
@@ -47,6 +60,9 @@ extern void InjectionPointCached(const char *name, void *arg);
extern bool IsInjectionPointAttached(const char *name);
extern bool InjectionPointDetach(const char *name);
+/* Get the current set of injection points attached */
+extern List *InjectionPointList(void);
+
#ifdef EXEC_BACKEND
extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints;
#endif
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
index c0987dca155..8abc26abce2 100644
--- a/src/include/utils/memutils.h
+++ b/src/include/utils/memutils.h
@@ -18,9 +18,6 @@
#define MEMUTILS_H
#include "nodes/memnodes.h"
-#include "storage/condition_variable.h"
-#include "storage/lmgr.h"
-#include "utils/dsa.h"
/*
@@ -51,23 +48,6 @@
#define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize)
-/*
- * Memory Context reporting size limits.
- */
-
-/* Max length of context name and ident */
-#define MEMORY_CONTEXT_IDENT_SHMEM_SIZE 64
-/* Maximum size (in bytes) of DSA area per process */
-#define MEMORY_CONTEXT_REPORT_MAX_PER_BACKEND ((size_t) (1 * 1024 * 1024))
-
-/*
- * Maximum size per context. Actual size may be lower as this assumes the worst
- * case of deepest path and longest identifiers (name and ident, thus the
- * multiplication by 2). The path depth is limited to 100 like for memory
- * context logging.
- */
-#define MAX_MEMORY_CONTEXT_STATS_SIZE (sizeof(MemoryStatsEntry) + \
- (100 * sizeof(int)) + (2 * MEMORY_CONTEXT_IDENT_SHMEM_SIZE))
/*
* Standard top-level memory contexts.
@@ -339,66 +319,4 @@ pg_memory_is_all_zeros(const void *ptr, size_t len)
return true;
}
-/* Dynamic shared memory state for statistics per context */
-typedef struct MemoryStatsEntry
-{
- dsa_pointer name;
- dsa_pointer ident;
- dsa_pointer path;
- NodeTag type;
- int path_length;
- int levels;
- int64 totalspace;
- int64 nblocks;
- int64 freespace;
- int64 freechunks;
- int num_agg_stats;
-} MemoryStatsEntry;
-
-/*
- * Static shared memory state representing the DSA area created for memory
- * context statistics reporting. A single DSA area is created and used by all
- * the processes, each having its specific DSA allocations for sharing memory
- * statistics, tracked by per backend static shared memory state.
- */
-typedef struct MemoryStatsCtl
-{
- dsa_handle memstats_dsa_handle;
- LWLock lw_lock;
-} MemoryStatsCtl;
-
-/*
- * Per backend static shared memory state for memory context statistics
- * reporting.
- */
-typedef struct MemoryStatsBackendState
-{
- ConditionVariable memcxt_cv;
- LWLock lw_lock;
- int proc_id;
- int total_stats;
- bool summary;
- dsa_pointer memstats_dsa_pointer;
- TimestampTz stats_timestamp;
-} MemoryStatsBackendState;
-
-
-/*
- * Used for storage of transient identifiers for pg_get_backend_memory_contexts
- */
-typedef struct MemoryStatsContextId
-{
- MemoryContext context;
- int context_id;
-} MemoryStatsContextId;
-
-extern PGDLLIMPORT MemoryStatsBackendState *memCxtState;
-extern PGDLLIMPORT MemoryStatsCtl *memCxtArea;
-extern PGDLLIMPORT dsa_area *MemoryStatsDsaArea;
-extern void ProcessGetMemoryContextInterrupt(void);
-extern const char *ContextTypeToString(NodeTag type);
-extern void HandleGetMemoryContextInterrupt(void);
-extern Size MemoryContextReportingShmemSize(void);
-extern void MemoryContextReportingShmemInit(void);
-extern void AtProcExit_memstats_cleanup(int code, Datum arg);
#endif /* MEMUTILS_H */
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index 7b8cbf58d2c..44ff60a25b4 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -12,6 +12,8 @@
#ifndef _PG_LOCALE_
#define _PG_LOCALE_
+#include "mb/pg_wchar.h"
+
#ifdef USE_ICU
#include <unicode/ucol.h>
#endif
@@ -77,6 +79,52 @@ struct collate_methods
bool strxfrm_is_safe;
};
+struct ctype_methods
+{
+ /* case mapping: LOWER()/INITCAP()/UPPER() */
+ size_t (*strlower) (char *dest, size_t destsize,
+ const char *src, ssize_t srclen,
+ pg_locale_t locale);
+ size_t (*strtitle) (char *dest, size_t destsize,
+ const char *src, ssize_t srclen,
+ pg_locale_t locale);
+ size_t (*strupper) (char *dest, size_t destsize,
+ const char *src, ssize_t srclen,
+ pg_locale_t locale);
+ size_t (*strfold) (char *dest, size_t destsize,
+ const char *src, ssize_t srclen,
+ pg_locale_t locale);
+
+ /* required */
+ bool (*wc_isdigit) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isalpha) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isalnum) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isupper) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_islower) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isgraph) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isprint) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_ispunct) (pg_wchar wc, pg_locale_t locale);
+ bool (*wc_isspace) (pg_wchar wc, pg_locale_t locale);
+ pg_wchar (*wc_toupper) (pg_wchar wc, pg_locale_t locale);
+ pg_wchar (*wc_tolower) (pg_wchar wc, pg_locale_t locale);
+
+ /* required */
+ bool (*char_is_cased) (char ch, pg_locale_t locale);
+
+ /*
+ * Optional. If defined, will only be called for single-byte encodings. If
+ * not defined, or if the encoding is multibyte, will fall back to
+ * pg_strlower().
+ */
+ char (*char_tolower) (unsigned char ch, pg_locale_t locale);
+
+ /*
+ * For regex and pattern matching efficiency, the maximum char value
+ * supported by the above methods. If zero, limit is set by regex code.
+ */
+ pg_wchar max_chr;
+};
+
/*
* We use a discriminated union to hold either a locale_t or an ICU collator.
* pg_locale_t is occasionally checked for truth, so make it a pointer.
@@ -95,13 +143,13 @@ struct collate_methods
*/
struct pg_locale_struct
{
- char provider;
bool deterministic;
bool collate_is_c;
bool ctype_is_c;
bool is_default;
const struct collate_methods *collate; /* NULL if collate_is_c */
+ const struct ctype_methods *ctype; /* NULL if ctype_is_c */
union
{
@@ -125,6 +173,10 @@ extern void init_database_collation(void);
extern pg_locale_t pg_newlocale_from_collation(Oid collid);
extern char *get_collation_actual_version(char collprovider, const char *collcollate);
+
+extern bool char_is_cased(char ch, pg_locale_t locale);
+extern bool char_tolower_enabled(pg_locale_t locale);
+extern char char_tolower(unsigned char ch, pg_locale_t locale);
extern size_t pg_strlower(char *dst, size_t dstsize,
const char *src, ssize_t srclen,
pg_locale_t locale);
diff --git a/src/include/utils/skipsupport.h b/src/include/utils/skipsupport.h
index bc51847cf61..c42be001fb5 100644
--- a/src/include/utils/skipsupport.h
+++ b/src/include/utils/skipsupport.h
@@ -90,7 +90,7 @@ typedef struct SkipSupportData
*/
SkipSupportIncDec decrement;
SkipSupportIncDec increment;
-} SkipSupportData;
+} SkipSupportData;
extern SkipSupport PrepareSkipSupportFromOpclass(Oid opfamily, Oid opcintype,
bool reverse);
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h
index 8c205859c3b..93531732b08 100644
--- a/src/include/utils/timestamp.h
+++ b/src/include/utils/timestamp.h
@@ -144,6 +144,9 @@ extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2);
extern TimestampTz timestamp2timestamptz_opt_overflow(Timestamp timestamp,
int *overflow);
+extern Timestamp timestamptz2timestamp_opt_overflow(TimestampTz timestamp,
+ int *overflow);
+
extern int32 timestamp_cmp_timestamptz_internal(Timestamp timestampVal,
TimestampTz dt2);