Re: Open 7.1 items
От | Peter Eisentraut |
---|---|
Тема | Re: Open 7.1 items |
Дата | |
Msg-id | Pine.LNX.4.30.0102142124530.1112-100000@peter.localdomain обсуждение исходный текст |
Ответ на | Re: Open 7.1 items (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Open 7.1 items
GET DIAGNOSTICS (was Re: Open 7.1 items) |
Список | pgsql-hackers |
Bruce Momjian writes: > > Bruce Momjian writes: > > > > > New PL/pgSQL GET DIAGNOSTICS statement for SPI value access (Jan) > > > > If someone can show me an example of how it operates I can write up > > something. > > I found: > > > 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>; > > > > Looking at plpgsql/src/gram.y, it only supports PROCESSED (rows > returned/affected) and RESULT (OID). The grammar indicates that only > SELECT is allowed in GET DIAGNOSTICS SELECT. Jan says it works for > INSERT/UPDATE/DELETE too, but I guess you still use GET DIAGNOSTICS > SELECT. May I suggest that this is the wrong syntax? It should be GET DIAGNOSTICS <variable> = ROW_COUNT; See SQL99 part 2, clause 19.1. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
В списке pgsql-hackers по дате отправления: