From 95cc41b81dd3917a1b9bb0b7c9cbe231d2557760 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 25 Apr 1999 03:19:27 +0000 Subject: 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. --- src/backend/commands/async.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/async.c') 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. -- cgit v1.2.3