Postgres Global Variables

Started by Nonameover 25 years ago3 messagesgeneral
Jump to latest
#1Noname
shm@daimlerchrysler.com

I've been asked to port a Sybase database to Postgres in order to do an
initial checkout of Postgres' capabilities. I've been successful for the
most part, but have run into a problem with the triggers. The triggers
make use of a Sybase global variable called @@rowcount. @@rowcount
represents the number of rows affected by the most recent data modification
operation (inserts, deletes and/or updates).

Is there an equivalent in Postgres? Thanks much for the help.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: Postgres Global Variables

shm@daimlerchrysler.com writes:

make use of a Sybase global variable called @@rowcount. @@rowcount
represents the number of rows affected by the most recent data modification
operation (inserts, deletes and/or updates).

Is there an equivalent in Postgres? Thanks much for the help.

I think the libpq function PQcmdTuples() does what you want, although
it's possible Sybase's behavior differs in some details.

regards, tom lane

#3Jan Wieck
JanWieck@Yahoo.com
In reply to: Tom Lane (#2)
Re: Postgres Global Variables

Tom Lane wrote:

shm@daimlerchrysler.com writes:

make use of a Sybase global variable called @@rowcount. @@rowcount
represents the number of rows affected by the most recent data modification
operation (inserts, deletes and/or updates).

Is there an equivalent in Postgres? Thanks much for the help.

I think the libpq function PQcmdTuples() does what you want, although
it's possible Sybase's behavior differs in some details.

In the 7.1 tree are changes from Philip Warner, gaining
access to this info from PL/pgSQL (new GET DIAGNOSTICS
command). I think this is closer to what he's looking for.

Jan

--

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