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

From Jan Wieck
Subject Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Date
Msg-id 200102191954.OAA01935@jupiter.jw.home
Whole thread Raw
In response to GET DIAGNOSTICS (was Re: Open 7.1 items)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 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?
   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,
themain   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@Yahoo.com #



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



pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Next
From: Tom Lane
Date:
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)