should xlog_outdesc modify its argument?
The function
static void xlog_outdesc(StringInfo buf, XLogReaderState *record);
in src/backend/access/transam/xlog.c is called by XLogInsertRecord,
and after returning a string describing an XLogRecord, it clears the
state data in its XLogReaderState argument. That mixes the read-only
semantics of "give me a string that describes this argument" and the
read-write semantics of "clear out the value in this argument". That
seems ok, except that xlog_outdesc is also called by the function
static void rm_redo_error_callback(const void *arg);
also in xlog.c, which appears to only want the string description of the
argument, and not the side effect of clearing out the value. Now,
perhaps under exceptional conditions it won't matter one way or the
other if the xlog record gets modified; perhaps it's going to be discarded
anyway. I didn't look far enough to find out. But this is the only function
of all the (void)(void *arg) callback functions in the entire postgresql
source tree that modifies its argument. I discovered this while trying
to convert all the callback function signatures to (void)(const void *),
and this was the only monkey-wrench in the works.
Is this a bug? Do I just have to live with the unfortunate lack of
orthogonality in the callback mechanisms? At the very least, there
should perhaps be some documentation about how all this is intended
to work.
Thanks, please find my work-in-progress attempt and constify-ing
these functions attached.
Mark Dilger
Attachments:
callback.patch.wip.1application/octet-stream; name=callback.patch.wip.1Download
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index daf0438..1c14b54 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -396,7 +396,7 @@ static HeapTuple make_tuple_from_result_row(PGresult *res,
List *retrieved_attrs,
ForeignScanState *fsstate,
MemoryContext temp_context);
-static void conversion_error_callback(void *arg);
+static void conversion_error_callback(const void *arg);
static bool foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel,
JoinType jointype, RelOptInfo *outerrel, RelOptInfo *innerrel,
JoinPathExtraData *extra);
@@ -4521,12 +4521,12 @@ make_tuple_from_result_row(PGresult *res,
* conversion. Print names of column and relation.
*/
static void
-conversion_error_callback(void *arg)
+conversion_error_callback(const void *arg)
{
const char *attname = NULL;
const char *relname = NULL;
bool is_wholerow = false;
- ConversionLocation *errpos = (ConversionLocation *) arg;
+ const ConversionLocation *errpos = (const ConversionLocation *) arg;
if (errpos->rel)
{
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c1b9a97..6039972 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -849,7 +849,7 @@ static bool read_backup_label(XLogRecPtr *checkPointLoc,
bool *backupEndRequired, bool *backupFromStandby);
static bool read_tablespace_map(List **tablespaces);
-static void rm_redo_error_callback(void *arg);
+static void rm_redo_error_callback(const void *arg);
static int get_sync_bit(int method);
static void CopyXLogRecordToWAL(int write_len, bool isLogSwitch,
@@ -10937,8 +10937,13 @@ read_tablespace_map(List **tablespaces)
* Error context callback for errors occurring during rm_redo().
*/
static void
-rm_redo_error_callback(void *arg)
+rm_redo_error_callback(const void *arg)
{
+ /*
+ * We have to cast away the const because xlog_outdesc passes
+ * 'record' through the rm_desc functor which modifies the
+ * data. This is ugly, but there is no obvious workaround.
+ */
XLogReaderState *record = (XLogReaderState *) arg;
StringInfoData buf;
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index c1d1505..f3a20dd 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -51,7 +51,7 @@ typedef struct
char *prosrc;
} parse_error_callback_arg;
-static void sql_function_parse_error_callback(void *arg);
+static void sql_function_parse_error_callback(const void *arg);
static int match_prosrc_to_query(const char *prosrc, const char *queryText,
int cursorpos);
static bool match_prosrc_to_literal(const char *prosrc, const char *literal,
@@ -962,9 +962,9 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
* Error context callback for handling errors in SQL function definitions
*/
static void
-sql_function_parse_error_callback(void *arg)
+sql_function_parse_error_callback(const void *arg)
{
- parse_error_callback_arg *callback_arg = (parse_error_callback_arg *) arg;
+ const parse_error_callback_arg *callback_arg = (const parse_error_callback_arg *) arg;
/* See if it's a syntax error; if so, transpose to CREATE FUNCTION */
if (!function_parse_error_transpose(callback_arg->prosrc))
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 432b0ca..c79ad26 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -2122,9 +2122,9 @@ CopyOneRowTo(CopyState cstate, Oid tupleOid, Datum *values, bool *nulls)
* The argument for the error context must be CopyState.
*/
void
-CopyFromErrorCallback(void *arg)
+CopyFromErrorCallback(const void *arg)
{
- CopyState cstate = (CopyState) arg;
+ const CopyStateData *cstate = (const CopyStateData *) arg;
if (cstate->binary)
{
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index eb531af..f0e4476 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -46,7 +46,7 @@ typedef struct
} import_error_callback_arg;
/* Internal functions */
-static void import_error_callback(void *arg);
+static void import_error_callback(const void *arg);
/*
@@ -1613,9 +1613,9 @@ ImportForeignSchema(ImportForeignSchemaStmt *stmt)
* error context callback to let us supply the failing SQL statement's text
*/
static void
-import_error_callback(void *arg)
+import_error_callback(const void *arg)
{
- import_error_callback_arg *callback_arg = (import_error_callback_arg *) arg;
+ const import_error_callback_arg *callback_arg = (const import_error_callback_arg *) arg;
int syntaxerrposition;
/* If it's a syntax error, convert to internal syntax error report */
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 470db5b..db58839 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -164,7 +164,7 @@ static Datum postquel_get_single_result(TupleTableSlot *slot,
FunctionCallInfo fcinfo,
SQLFunctionCachePtr fcache,
MemoryContext resultcontext);
-static void sql_exec_error_callback(void *arg);
+static void sql_exec_error_callback(const void *arg);
static void ShutdownSQLFunction(Datum arg);
static void sqlfunction_startup(DestReceiver *self, int operation, TupleDesc typeinfo);
static bool sqlfunction_receive(TupleTableSlot *slot, DestReceiver *self);
@@ -1357,9 +1357,9 @@ fmgr_sql(PG_FUNCTION_ARGS)
* error context callback to let us supply a call-stack traceback
*/
static void
-sql_exec_error_callback(void *arg)
+sql_exec_error_callback(const void *arg)
{
- FmgrInfo *flinfo = (FmgrInfo *) arg;
+ const FmgrInfo *flinfo = (const FmgrInfo *) arg;
SQLFunctionCachePtr fcache = (SQLFunctionCachePtr) flinfo->fn_extra;
int syntaxerrposition;
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 38767ae..6a5beea 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -63,7 +63,7 @@ static ParamListInfo _SPI_convert_params(int nargs, Oid *argtypes,
static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount);
-static void _SPI_error_callback(void *arg);
+static void _SPI_error_callback(const void *arg);
static void _SPI_cursor_operation(Portal portal,
FetchDirection direction, long count,
@@ -1265,7 +1265,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
* throws an error.
*/
spierrcontext.callback = _SPI_error_callback;
- spierrcontext.arg = (void *) plansource->query_string;
+ spierrcontext.arg = (const void *) plansource->query_string;
spierrcontext.previous = error_context_stack;
error_context_stack = &spierrcontext;
@@ -1693,7 +1693,7 @@ SPI_plan_get_cached_plan(SPIPlanPtr plan)
/* Setup error traceback support for ereport() */
spierrcontext.callback = _SPI_error_callback;
- spierrcontext.arg = (void *) plansource->query_string;
+ spierrcontext.arg = (const void *) plansource->query_string;
spierrcontext.previous = error_context_stack;
error_context_stack = &spierrcontext;
@@ -1835,7 +1835,7 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
* Setup error traceback support for ereport()
*/
spierrcontext.callback = _SPI_error_callback;
- spierrcontext.arg = (void *) src;
+ spierrcontext.arg = (const void *) src;
spierrcontext.previous = error_context_stack;
error_context_stack = &spierrcontext;
@@ -1938,7 +1938,7 @@ _SPI_prepare_oneshot_plan(const char *src, SPIPlanPtr plan)
* Setup error traceback support for ereport()
*/
spierrcontext.callback = _SPI_error_callback;
- spierrcontext.arg = (void *) src;
+ spierrcontext.arg = (const void *) src;
spierrcontext.previous = error_context_stack;
error_context_stack = &spierrcontext;
@@ -2047,7 +2047,7 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
List *stmt_list;
ListCell *lc2;
- spierrcontext.arg = (void *) plansource->query_string;
+ spierrcontext.arg = (const void *) plansource->query_string;
/*
* If this is a one-shot plan, we still need to do parse analysis.
@@ -2439,7 +2439,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount)
* Add context information when a query invoked via SPI fails
*/
static void
-_SPI_error_callback(void *arg)
+_SPI_error_callback(const void *arg)
{
const char *query = (const char *) arg;
int syntaxerrposition;
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 663ffe0..f39cfad 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -148,7 +148,7 @@ static Node *substitute_actual_parameters(Node *expr, int nargs, List *args,
int *usecounts);
static Node *substitute_actual_parameters_mutator(Node *node,
substitute_actual_parameters_context *context);
-static void sql_inline_error_callback(void *arg);
+static void sql_inline_error_callback(const void *arg);
static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
Oid result_collation);
static Query *substitute_actual_srf_parameters(Query *expr,
@@ -4671,9 +4671,9 @@ substitute_actual_parameters_mutator(Node *node,
* error context callback to let us supply a call-stack traceback
*/
static void
-sql_inline_error_callback(void *arg)
+sql_inline_error_callback(const void *arg)
{
- inline_error_callback_arg *callback_arg = (inline_error_callback_arg *) arg;
+ const inline_error_callback_arg *callback_arg = (const inline_error_callback_arg *) arg;
int syntaxerrposition;
/* If it's a syntax error, convert to internal syntax error report */
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 62d2f71..ba6ccd0 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -31,7 +31,7 @@
#include "utils/varbit.h"
-static void pcb_error_callback(void *arg);
+static void pcb_error_callback(const void *arg);
/*
@@ -169,9 +169,9 @@ cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
* if the error is a query cancel --- are there any other important cases?
*/
static void
-pcb_error_callback(void *arg)
+pcb_error_callback(const void *arg)
{
- ParseCallbackState *pcbstate = (ParseCallbackState *) arg;
+ const ParseCallbackState *pcbstate = (const ParseCallbackState *) arg;
if (geterrcode() != ERRCODE_QUERY_CANCELED)
(void) parser_errposition(pcbstate->pstate, pcbstate->location);
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index a8bb472..e7f9152 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -664,7 +664,7 @@ typeidTypeRelid(Oid type_id)
* error context callback for parse failure during parseTypeString()
*/
static void
-pts_error_callback(void *arg)
+pts_error_callback(const void *arg)
{
const char *str = (const char *) arg;
@@ -706,7 +706,7 @@ typeStringToTypeName(const char *str)
* Setup error traceback support in case of ereport() during parse
*/
ptserrcontext.callback = pts_error_callback;
- ptserrcontext.arg = (void *) str;
+ ptserrcontext.arg = (const void *) str;
ptserrcontext.previous = error_context_stack;
error_context_stack = &ptserrcontext;
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index 1512be5..f978e68 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -53,7 +53,7 @@ typedef struct LogicalErrorCallbackState
} LogicalErrorCallbackState;
/* wrappers around output plugin callbacks */
-static void output_plugin_error_callback(void *arg);
+static void output_plugin_error_callback(const void *arg);
static void startup_cb_wrapper(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
bool is_init);
static void shutdown_cb_wrapper(LogicalDecodingContext *ctx);
@@ -518,9 +518,9 @@ LoadOutputPlugin(OutputPluginCallbacks *callbacks, char *plugin)
}
static void
-output_plugin_error_callback(void *arg)
+output_plugin_error_callback(const void *arg)
{
- LogicalErrorCallbackState *state = (LogicalErrorCallbackState *) arg;
+ const LogicalErrorCallbackState *state = (const LogicalErrorCallbackState *) arg;
/* not all callbacks have an associated LSN */
if (state->report_location != InvalidXLogRecPtr)
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 90804a3..29dd558 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -442,8 +442,8 @@ static void WaitIO(BufferDesc *buf);
static bool StartBufferIO(BufferDesc *buf, bool forInput);
static void TerminateBufferIO(BufferDesc *buf, bool clear_dirty,
uint32 set_flag_bits);
-static void shared_buffer_write_error_callback(void *arg);
-static void local_buffer_write_error_callback(void *arg);
+static void shared_buffer_write_error_callback(const void *arg);
+static void local_buffer_write_error_callback(const void *arg);
static BufferDesc *BufferAlloc(SMgrRelation smgr,
char relpersistence,
ForkNumber forkNum,
@@ -2665,7 +2665,7 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln)
/* Setup error traceback support for ereport() */
errcallback.callback = shared_buffer_write_error_callback;
- errcallback.arg = (void *) buf;
+ errcallback.arg = (const void *) buf;
errcallback.previous = error_context_stack;
error_context_stack = &errcallback;
@@ -3154,7 +3154,7 @@ FlushRelationBuffers(Relation rel)
/* Setup error traceback support for ereport() */
errcallback.callback = local_buffer_write_error_callback;
- errcallback.arg = (void *) bufHdr;
+ errcallback.arg = (const void *) bufHdr;
errcallback.previous = error_context_stack;
error_context_stack = &errcallback;
@@ -3963,9 +3963,9 @@ AbortBufferIO(void)
* Error context callback for errors occurring during shared buffer writes.
*/
static void
-shared_buffer_write_error_callback(void *arg)
+shared_buffer_write_error_callback(const void *arg)
{
- BufferDesc *bufHdr = (BufferDesc *) arg;
+ const BufferDesc *bufHdr = (const BufferDesc *) arg;
/* Buffer is pinned, so we can read the tag without locking the spinlock */
if (bufHdr != NULL)
@@ -3982,9 +3982,9 @@ shared_buffer_write_error_callback(void *arg)
* Error context callback for errors occurring during local buffer writes.
*/
static void
-local_buffer_write_error_callback(void *arg)
+local_buffer_write_error_callback(const void *arg)
{
- BufferDesc *bufHdr = (BufferDesc *) arg;
+ const BufferDesc *bufHdr = (const BufferDesc *) arg;
if (bufHdr != NULL)
{
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index cbee20e..483c24b 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -56,7 +56,7 @@ typedef struct XactLockTableWaitInfo
ItemPointer ctid;
} XactLockTableWaitInfo;
-static void XactLockTableWaitErrorCb(void *arg);
+static void XactLockTableWaitErrorCb(const void *arg);
/*
* RelationInitLockInfo
@@ -700,9 +700,9 @@ SpeculativeInsertionWait(TransactionId xid, uint32 token)
* Error context callback for transaction lock waits.
*/
static void
-XactLockTableWaitErrorCb(void *arg)
+XactLockTableWaitErrorCb(const void *arg)
{
- XactLockTableWaitInfo *info = (XactLockTableWaitInfo *) arg;
+ const XactLockTableWaitInfo *info = (const XactLockTableWaitInfo *) arg;
/*
* We would like to print schema name too, but that would require a
diff --git a/src/backend/tsearch/ts_locale.c b/src/backend/tsearch/ts_locale.c
index 85e1cd0..65ba6b0 100644
--- a/src/backend/tsearch/ts_locale.c
+++ b/src/backend/tsearch/ts_locale.c
@@ -18,7 +18,7 @@
#include "tsearch/ts_locale.h"
#include "tsearch/ts_public.h"
-static void tsearch_readline_callback(void *arg);
+static void tsearch_readline_callback(const void *arg);
#ifdef USE_WIDE_UPPER_LOWER
@@ -162,9 +162,9 @@ tsearch_readline_end(tsearch_readline_state *stp)
* configuration file.
*/
static void
-tsearch_readline_callback(void *arg)
+tsearch_readline_callback(const void *arg)
{
- tsearch_readline_state *stp = (tsearch_readline_state *) arg;
+ const tsearch_readline_state *stp = (const tsearch_readline_state *) arg;
/*
* We can't include the text of the config line for errors that occur
diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h
index 65eb347..379a0ee 100644
--- a/src/include/commands/copy.h
+++ b/src/include/commands/copy.h
@@ -33,7 +33,7 @@ extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext,
Datum *values, bool *nulls, Oid *tupleOid);
extern bool NextCopyFromRawFields(CopyState cstate,
char ***fields, int *nfields);
-extern void CopyFromErrorCallback(void *arg);
+extern void CopyFromErrorCallback(const void *arg);
extern DestReceiver *CreateCopyDestReceiver(void);
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 70dc365..1e73c46 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -236,8 +236,8 @@ extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2);
typedef struct ErrorContextCallback
{
struct ErrorContextCallback *previous;
- void (*callback) (void *arg);
- void *arg;
+ void (*callback) (const void *arg);
+ const void *arg;
} ErrorContextCallback;
extern PGDLLIMPORT ErrorContextCallback *error_context_stack;
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 18948c8..63ad31c 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -92,7 +92,7 @@ static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
PLpgSQL_function *function,
PLpgSQL_func_hashkey *hashkey,
bool forValidator);
-static void plpgsql_compile_error_callback(void *arg);
+static void plpgsql_compile_error_callback(const void *arg);
static void add_parameter_name(PLpgSQL_nsitem_type itemtype, int itemno, const char *name);
static void add_dummy_return(PLpgSQL_function *function);
static Node *plpgsql_pre_column_ref(ParseState *pstate, ColumnRef *cref);
@@ -919,7 +919,7 @@ plpgsql_compile_inline(char *proc_source)
* source text is passed as an argument.
*/
static void
-plpgsql_compile_error_callback(void *arg)
+plpgsql_compile_error_callback(const void *arg)
{
if (arg)
{
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 470cf93..03dc187 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -155,7 +155,7 @@ static HTAB *shared_cast_hash = NULL;
/************************************************************
* Local function forward declarations
************************************************************/
-static void plpgsql_exec_error_callback(void *arg);
+static void plpgsql_exec_error_callback(const void *arg);
static PLpgSQL_datum *copy_plpgsql_datum(PLpgSQL_datum *datum);
static MemoryContext get_stmt_mcontext(PLpgSQL_execstate *estate);
static void push_stmt_mcontext(PLpgSQL_execstate *estate);
@@ -966,9 +966,9 @@ plpgsql_exec_event_trigger(PLpgSQL_function *func, EventTriggerData *trigdata)
* error context callback to let us supply a call-stack traceback
*/
static void
-plpgsql_exec_error_callback(void *arg)
+plpgsql_exec_error_callback(const void *arg)
{
- PLpgSQL_execstate *estate = (PLpgSQL_execstate *) arg;
+ const PLpgSQL_execstate *estate = (const PLpgSQL_execstate *) arg;
if (estate->err_text != NULL)
{
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 0b41e3a..4a2d865 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -98,7 +98,7 @@ static PLpgSQL_row *make_scalar_list1(char *initial_name,
int lineno, int location);
static void check_sql_expr(const char *stmt, int location,
int leaderlen);
-static void plpgsql_sql_error_callback(void *arg);
+static void plpgsql_sql_error_callback(const void *arg);
static PLpgSQL_type *parse_datatype(const char *string, int location);
static void check_labels(const char *start_label,
const char *end_label,
@@ -3556,9 +3556,9 @@ check_sql_expr(const char *stmt, int location, int leaderlen)
}
static void
-plpgsql_sql_error_callback(void *arg)
+plpgsql_sql_error_callback(const void *arg)
{
- sql_error_callback_arg *cbarg = (sql_error_callback_arg *) arg;
+ const sql_error_callback_arg *cbarg = (const sql_error_callback_arg *) arg;
int errpos;
/*
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index c84a97b..f83b109 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -976,7 +976,7 @@ typedef struct PLpgSQL_plugin
void (*stmt_end) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt);
/* Function pointers set by PL/pgSQL itself */
- void (*error_callback) (void *arg);
+ void (*error_callback) (const void *arg);
void (*assign_expr) (PLpgSQL_execstate *estate, PLpgSQL_datum *target,
PLpgSQL_expr *expr);
} PLpgSQL_plugin;
On 09/28/2016 02:35 AM, Mark Dilger wrote:
The function
static void xlog_outdesc(StringInfo buf, XLogReaderState *record);
in src/backend/access/transam/xlog.c is called by XLogInsertRecord,
and after returning a string describing an XLogRecord, it clears the
state data in its XLogReaderState argument. That mixes the read-only
semantics of "give me a string that describes this argument" and the
read-write semantics of "clear out the value in this argument".
I don't see where the "clears the state data" is happening. Can you
elaborate?
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sep 27, 2016, at 11:25 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 09/28/2016 02:35 AM, Mark Dilger wrote:
The function
static void xlog_outdesc(StringInfo buf, XLogReaderState *record);
in src/backend/access/transam/xlog.c is called by XLogInsertRecord,
and after returning a string describing an XLogRecord, it clears the
state data in its XLogReaderState argument. That mixes the read-only
semantics of "give me a string that describes this argument" and the
read-write semantics of "clear out the value in this argument".I don't see where the "clears the state data" is happening. Can you elaborate?
My apologies. At the bottom of the function, it calls through the function pointer
RmgrTable[rmid].rm_desc(buf, record);
which is set up to call various *_desc functions. I must have chased through
those function pointers incorrectly, as I can't find the problem now that I am
reviewing all those functions.
Sorry for the noise,
Mark Dilger
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers