Re: GET DIAGNOSTICS (was Re: Open 7.1 items) - Mailing list pgsql-hackers

From Philip Warner
Subject Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Date
Msg-id 3.0.5.32.20010219123326.02d91d60@mail.rhyme.com.au
Whole thread Raw
In response to GET DIAGNOSTICS (was Re: Open 7.1 items)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GET DIAGNOSTICS (was Re: Open 7.1 items)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: GET DIAGNOSTICS (was Re: Open 7.1 items)  (Jan Wieck <janwieck@Yahoo.com>)
List pgsql-hackers
At 18:49 18/02/01 -0500, Tom Lane wrote:
>Peter Eisentraut <peter_e@gmx.net> writes:
>> :
>> :    GET DIAGNOSTICS SELECT RESULT INTO <int4_variable>;
>
>> May I suggest that this is the wrong syntax?  It should be
>
>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?

Sadly, we made it up. I needed to get the SPI variables and we came up with
this. I sent the patches for PROCESSED and RESULT in 1999 (I think) - pre
V6.5, anyway. I had no idea that they had been applied until people started
asking questions about them.


>I'd be more inclined to follow the spec than Oracle, anyway.

I agree.

However, there is a case for keeping the 'select' version as well; you have
already raised the need to handle the 'OID' case, and I can imagine there
might be a few other PG-specific things we might want in the future -
keeping the two separate may be a good option:

We *do* need to support ROW_COUNT, but allowing
   GET DIAGNOSTICS Select ROW_COUNT, SQLCODE, OID Into :a,:b:,:c;

is a lot friendlier than the standard:
   GET DIAGNOSTICS :a = ROW_COUNT;   GET DIAGNOSTICS EXCEPTION 1 :b = SQLCODE;   GET DIAGNOSTICS :c = OID;

(not that we even support SQLCODE at this stage).


>if we're going to change it, we'd better do so before 7.1 release,
>else we'll have a backwards-compatibility problem.

*If* you accept the desirability of 'select', then this is not true.


P.S. Is Jan around? He's been very quiet recently...



----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug: aliasing in ORDER BY when UNIONing
Next
From: Tom Lane
Date:
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)