Re: Bug in PL/pgSQL GET DIAGNOSTICS?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in PL/pgSQL GET DIAGNOSTICS?
Date: 2002-09-26 01:40:03
Message-ID: 200209260140.g8Q1e4Y21682@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I already have a TODO item:
> > * Return proper effected tuple count from complex commands [return]
> > I am unsure if it will be fixed in 7.3 or not. It is still on the open
> > items list, and I think we have a general plan to fix it.
>
> I got distracted and wasn't following the thread a few days ago about
> the topic. Did people come to a consensus about how it should work?

OK, I am back. I think the most promising proposal was from you, Tom:

http://candle.pha.pa.us/mhonarc/todo.detail/return/msg00012.html

It basically breaks down the three results (tag, oid, tuple count), and
the INSTEAD/non-INSTEAD behavior.

I actually got a big chuckle from this paragraph:

Come on, guys, work with me a little here. I've thrown out several
alternative suggestions already, and all I've gotten from either of
you is refusal to think about the problem.

I liked the "work with me" phrase.

To summarize, with non-INSTEAD, we get the tag, oid, and tuple count of
the original query. Everyone agrees on that.

For non-INSTEAD, we have:

1) return original tag
2) return oid if all inserts in the rule insert only one row
3) return tuple count of all commands with the same tag

For item 2, it is possible to have multiple INSERTS in the rule and
return an oid if the sum of the inserts is only one row.

Item 3 is the most controversial. Some say sum all tuple counts, i.e.
sum INSERT/UPDATE/DELETE. That just seems to messy to me. I think
summing only the matching tags has the highest probability of returning
a meaningful number.

Also, item 2 and 3 work well together with INSERT because a tuple count
of 1 returns an oid, while > 1 does not, which is consistent with a
non-rule insert.

(FYI, I am still working SSL.)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-09-26 02:07:17 Re: postmaster -d option (was Re: [GENERAL] Relation 0 does not exist)
Previous Message Tatsuo Ishii 2002-09-26 01:37:48 Re: unicode