Re: Fix issuing of multiple command completions per command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fernando Nasser <fnasser(at)redhat(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Fix issuing of multiple command completions per command
Date: 2002-02-26 02:47:05
Message-ID: 26516.1014691625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Fernando Nasser <fnasser(at)redhat(dot)com> writes:
> (Please note that "[PATCHES] Allow arbitrary levels of
> analyze/rewriting" must be applied before this patch)

Actually, it looks like you accidentally included that patch as part of
this one. Since Bruce already applied that patch, this one will not
apply cleanly.

While this looks good as far as it goes, I don't think it
resolves the problems exposed by Coax's recent complaint:
http://archives.postgresql.org/pgsql-bugs/2002-02/msg00155.php

There are two remaining bogosities:

1. We need to get rid of the static variable CommandInfo that's
manipulated by UpdateCommandInfo; static state is certainly going
to be a bad idea in this context.

2. EndCommand should *not* be issued until we have completed all the
actions of the (rewritten) query. Moving EndCommand into
PerformPortalFetch, as you did here, is exactly the wrong direction.
What we need is for EndCommand to be executed from pg_exec_query_string.
That means that the tag auxiliary info (currently set up by
UpdateCommandInfo) has to be passed out from ProcessQuery to
pg_exec_query_string, which is the only place that can know when to send
the command completion notice back to the client.

As the comments in dest.h and dest.c point out, BeginCommand/EndCommand
are fairly confused in purpose and usage right now. Maybe rather than
patching, we ought to decide what functionality we really need and do a
major reconstruction job.

One rather nasty issue that arises here is that I don't think
pg_exec_query_string has enough knowledge to understand which of the
queries produced by query rewriting corresponds to the "original" query.
This is critical in order to figure out which command's auxiliary info
is the right stuff to pass back to the client. I suspect we will need
to expand QueryRewrite's API to identify the "main" query in the
returned query list.

Seems like we've opened a real can of worms here...

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2002-02-26 03:08:49 Re: Basic DOMAIN Support
Previous Message Bruce Momjian 2002-02-26 02:08:27 Re: ALTER TABLE OWNER: change indexes