Re: GET DIAGNOSTICS (was Re: Open 7.1 items)

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Date: 2001-02-19 01:33:26
Message-ID: 3.0.5.32.20010219123326.02d91d60@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 18:49 18/02/01 -0500, Tom Lane wrote:
>Peter Eisentraut <peter_e(at)gmx(dot)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 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-19 01:40:10 Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Previous Message Tom Lane 2001-02-19 01:24:20 Re: Bug: aliasing in ORDER BY when UNIONing