From: | Kenji Kawamura <kawamura(dot)kenji(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | pg_trigger.tgargs needs detoast |
Date: | 2007-01-18 09:04:52 |
Message-ID: | 45AF3834.9040102@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
This patch fixes a bug of case of extraction of pg_trigger.tgargs.
There was a problem when we used a long argument in defining trigger,
possibly resulting in a server crash.
Example:
We defined a CREATE TRIGGER such as follows and registered trigger.
In this case, the argument value which we received in the trigger
procedure was not right.
CREATE TRIGGER trigger_test BEFORE INSERT OR UPDATE ON sample FOR EACH
ROW EXECUTE PROCEDURE sample_trig('XXX...(more than 1823 characters)');
The trigger procedure which receives the argument:
Datum sample_trig(PG_FUNCTION_ARGS)
{
TriggerData* trigdata = (TriggerData*)fcinfo->context;
char** args = trigdata->tg_trigger->tgargs;
int nargs = trigdata->tg_trigger->tgnargs;
int i;
for (i = 0; i < nargs; i++) {
elog(LOG, "%s", args[i]);
}
...
}
Result:
Before: LOG: (the character that is not right, for example '%')
After : LOG: XXX...(more than 1823 characters)
Regards,
---
Kenji Kawamura
NTT Open Source Center, Japan
Attachment | Content-Type | Size |
---|---|---|
detoast_pg_trigger_tgargs.patch | text/plain | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | korryd | 2007-01-18 10:24:59 | Scanner/Parser question - what does _P imply? |
Previous Message | Takayuki Tsunakawa | 2007-01-18 03:05:48 | Re: What is the motivation of include directive and |