Re: Transactional issue that begs for explanation
| От | Tom Lane |
|---|---|
| Тема | Re: Transactional issue that begs for explanation |
| Дата | |
| Msg-id | 5703.1284171784@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Transactional issue that begs for explanation (Mladen Gogala <mladen.gogala@vmsinfo.com>) |
| Ответы |
Re: Transactional issue that begs for explanation
|
| Список | pgsql-novice |
Mladen Gogala <mladen.gogala@vmsinfo.com> writes:
> To make the story more interesting, I added the following:
> CREATE or REPLACE FUNCTION logtrg() RETURNS trigger AS $$
> open(STDOUT,">>/tmp/logfile") or die("Cannot open log:$!\n");
> $key=$_TD->{old}{key};
> $val=$_TD->{old}{val};
> print "Firing on: $key $val\n";
> return;
> $$ LANGUAGE plperlu;
I suspect you're shooting yourself in the foot by repeatedly re-opening
the backend's stdout and not fflush'ing anywhere along the line: somehow
the data going to the log file is getting mangled. I don't see any
strange behavior here when using a less dangerous logging technique,
such as
CREATE or REPLACE FUNCTION logtrg() RETURNS trigger AS $$
$key=$_TD->{old}{key};
$val=$_TD->{old}{val};
elog(NOTICE, "Firing on: $key $val\n");
return;
$$ LANGUAGE plperlu;
(Actually, I don't see anything funny when using your original version
of the function, either; but it's probably dependent on a lot of
platform-specific libc details exactly how you got that result.)
regards, tom lane
В списке pgsql-novice по дате отправления: