Re: [ADMIN] Latest transcation

Re: [ADMIN] Latest transcation

am 19.06.2003 13:41:12 von Anagha Joshi

Consider this:
Transcation begin
'
'
Insert on table x
'
'
Trascation end;

My client C++ front end is multi-threaded. The above 'transcation' block
is in thread -y .
I want to know the info. abt' last row inserted into table in this
transcation block.
Info contains the details like time of insertion of a row and data in
that row.
=20
I think this sufficely explains what I want.

-Anagha
-----Original Message-----
From: Bruno Wolff III [mailto:bruno@wolff.to]=20
Sent: Thursday, June 19, 2003 4:00 PM
To: Anagha Joshi
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Latest transcation


On Thu, Jun 19, 2003 at 10:46:22 +0530,
Anagha Joshi wrote:
> Hi All,
> Is there any way to know programatically which is the latest=20
> insert/update occured to a particular table? What are the values which

> are inserted/updated to that table?

That depends on what you really are trying to do. It sounds like using a
sequnce, nextval and currval might work. That could be used to track the
latest change in one session.

If you try to look at the latest change to a table accross all sessions,
things get a bit murky.

A more precise description of what you are trying to do might result in
some other suggestions.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Re: [ADMIN] Latest transcation

am 19.06.2003 16:07:36 von Jonathan Gardner

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 19 June 2003 04:41, Anagha Joshi wrote:
> My client C++ front end is multi-threaded. The above 'transcation' block
> is in thread -y .
> I want to know the info. abt' last row inserted into table in this
> transcation block.
> Info contains the details like time of insertion of a row and data in
> that row.
>
> I think this sufficely explains what I want.
>

There are some things you can do at the application level to record what wa=
s=20
done in a seperate thread or even process. With threads, you can use shared=
=20
variables and semaphores. With processes, you can use some form of IPC or=
=20
shared memory.

If you decide to go at an application layer, it is beyond the scope of the=
=20
ADMIN list, and better suited for a discussion with your peers in that=20
language and environment.

If you go for a server-side solution (because the application doesn't know=
=20
what was last inserted and when), then you'll want to use triggers as I=20
described in a previous posting.

- --=20
Jonathan Gardner
(was jgardn@alumni.washington.edu)
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+8cOoWgwF3QvpWNwRAmGkAJ4pE8Eb9V/kiyBFqLCqr/2nNqA3HwCg 0PE2
2TCK7YF50MKLwbUurS1aqlY=3D
=3DhvKY
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend