summaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-08-08 22:05:05 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-08-08 22:06:57 +0200
commitff89e182d42048380dba32fee1b491893c7b4bec (patch)
tree0790efd83844b24f915df14035fdec28a612b6ed /src/pl/plperl/plperl.c
parentdcfc0f891273eeeb85ce6e723decf5cc37f9b1c3 (diff)
Add missing Datum conversions
Add various missing conversions from and to Datum. The previous code mostly relied on implicit conversions or its own explicit casts instead of using the correct DatumGet*() or *GetDatum() functions. We think these omissions are harmless. Some actual bugs that were discovered during this process have been committed separately (80c758a2e1d, fd2ab03fea2). Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r--src/pl/plperl/plperl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 29cb4d7e47f..73ba1748fe0 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1453,7 +1453,7 @@ plperl_sv_to_literal(SV *sv, char *fqtypename)
check_spi_usage_allowed();
- typid = DirectFunctionCall1(regtypein, CStringGetDatum(fqtypename));
+ typid = DatumGetObjectId(DirectFunctionCall1(regtypein, CStringGetDatum(fqtypename)));
if (!OidIsValid(typid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2569,13 +2569,13 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
TriggerData *trigdata = ((TriggerData *) fcinfo->context);
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
- retval = (Datum) trigdata->tg_trigtuple;
+ retval = PointerGetDatum(trigdata->tg_trigtuple);
else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
- retval = (Datum) trigdata->tg_newtuple;
+ retval = PointerGetDatum(trigdata->tg_newtuple);
else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
- retval = (Datum) trigdata->tg_trigtuple;
+ retval = PointerGetDatum(trigdata->tg_trigtuple);
else if (TRIGGER_FIRED_BY_TRUNCATE(trigdata->tg_event))
- retval = (Datum) trigdata->tg_trigtuple;
+ retval = PointerGetDatum(trigdata->tg_trigtuple);
else
retval = (Datum) 0; /* can this happen? */
}