diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-04-25 03:19:27 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-04-25 03:19:27 +0000 |
commit | 95cc41b81dd3917a1b9bb0b7c9cbe231d2557760 (patch) | |
tree | 528782b9d55a9ceb7acbe4cc55c0699514ab284d /src/backend/commands/async.c | |
parent | fc08814e00c04cddad512494bb52d9266928619e (diff) | |
download | postgresql-95cc41b81dd3917a1b9bb0b7c9cbe231d2557760.tar.gz postgresql-95cc41b81dd3917a1b9bb0b7c9cbe231d2557760.zip |
Revise backend libpq interfaces so that messages to the frontend
can be generated in a buffer and then sent to the frontend in a single
libpq call. This solves problems with NOTICE and ERROR messages generated
in the middle of a data message or COPY OUT operation.
Diffstat (limited to 'src/backend/commands/async.c')
-rw-r--r-- | src/backend/commands/async.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 453019871e3..3d5cf92f7d1 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -6,7 +6,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.44 1999/02/13 23:15:00 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.45 1999/04/25 03:19:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -94,6 +94,7 @@ #include "fmgr.h" #include "lib/dllist.h" #include "libpq/libpq.h" +#include "libpq/pqformat.h" #include "miscadmin.h" #include "storage/bufmgr.h" #include "storage/lmgr.h" @@ -798,9 +799,12 @@ NotifyMyFrontEnd(char *relname, int32 listenerPID) { if (whereToSendOutput == Remote) { - pq_putnchar("A", 1); - pq_putint(listenerPID, sizeof(int32)); - pq_putstr(relname); + StringInfoData buf; + pq_beginmessage(&buf); + pq_sendbyte(&buf, 'A'); + pq_sendint(&buf, listenerPID, sizeof(int32)); + pq_sendstring(&buf, relname, strlen(relname)); + pq_endmessage(&buf); /* NOTE: we do not do pq_flush() here. For a self-notify, it will * happen at the end of the transaction, and for incoming notifies * ProcessIncomingNotify will do it after finding all the notifies. |