GET DIAGNOSTICS (was Re: Open 7.1 items)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: GET DIAGNOSTICS (was Re: Open 7.1 items)
Date: 2001-02-18 23:49:22
Message-ID: 20424.982540162@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Quoting a recent message by Jan Wieck <janwieck(at)Yahoo(dot)com>:
> :Do a
> :
> : GET DIAGNOSTICS SELECT PROCESSED INTO <int4_variable>;
> :
> :directly after an INSERT, UPDATE or DELETE statement and you'll know
> :how many rows have been hit.
> :
> :Also you can get the OID of an inserted row with
> :
> : GET DIAGNOSTICS SELECT RESULT INTO <int4_variable>;

> May I suggest that this is the wrong syntax? It should be
>
> GET DIAGNOSTICS <variable> = ROW_COUNT;
>
> See SQL99 part 2, clause 19.1.

Hmm, that's definitely what SQL99 uses for the syntax. I wonder where
Jan got the SELECT INTO syntax --- did he borrow it from Oracle?
Anyone have an Oracle manual to check?

I'd be more inclined to follow the spec than Oracle, anyway. But
if we're going to change it, we'd better do so before 7.1 release,
else we'll have a backwards-compatibility problem.

We'd need to come up with a name for the inserted-OID result,
since that's not one of the spec-listed items. I'd suggest just
GET DIAGNOSTICS <variable> = OID;
which seems unlikely to conflict with any future spec extension.
But maybe someone has a better idea.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mitch Vincent 2001-02-19 00:00:28 PHP 4.0.4pl1 / Beta 5
Previous Message Larry Rosenman 2001-02-18 23:02:57 Re: (forw) (forw) Re: PHP 4.0.4pl1 BUILD: BUSTED WITH CURRENT CVS