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

From: Jan Wieck <janwieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Date: 2001-02-19 19:54:30
Message-ID: 200102191954.OAA01935@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> 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?

Got it as a patch from - um - forgotten. Didn't new that
there is something in the SQL99.

> 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.

Agreed.

> 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.

The problem here is that the PL/pgSQL parser doesn't have the
mechanisms for enabling keywords as identifiers, the main
parser has. So using an existing type name might cause some
trouble. What about INSERTED_OID?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-19 20:03:36 Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Previous Message Jan Wieck 2001-02-19 19:47:39 Re: Re: WAL and commit_delay