Peter Eisentraut <peter_e@gmx.net> writes:
> Quoting a recent message by Jan Wieck <janwieck@Yahoo.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 justGET DIAGNOSTICS <variable> = OID;
which seems unlikely to conflict with any future spec extension.
But maybe someone has a better idea.
regards, tom lane