X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CAB9F30D177; Fri, 20 Jun 2003 13:43:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47323-03; Fri, 20 Jun 2003 10:43:39 -0300 (ADT) Received: from irko.smoothcorp.com (unknown [208.49.241.41]) by svr1.postgresql.org (Postfix) with ESMTP id D953F30DF0C; Fri, 20 Jun 2003 10:43:37 -0300 (ADT) Received: from jgardner.ifloor.com ([10.0.1.63]) by irko.smoothcorp.com with esmtp (Exim 4.12) id 19TMAz-0007R2-00; Fri, 20 Jun 2003 06:43:37 -0700 Received: from jgardner.ifloor.com (localhost.localdomain [127.0.0.1]) by jgardner.ifloor.com (8.12.8/8.12.8) with ESMTP id h5KDhcHK012706; Fri, 20 Jun 2003 06:43:38 -0700 Received: from localhost (localhost [[UNIX: localhost]]) by jgardner.ifloor.com (8.12.8/8.12.8/Submit) id h5KDhbX1012704; Fri, 20 Jun 2003 06:43:37 -0700 From: Jonathan Gardner To: "Anagha Joshi" Subject: Re: Latest transcation Date: Fri, 20 Jun 2003 06:43:18 -0700 User-Agent: KMail/1.5 Cc: , References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200306200643.37298.jgardner@jonathangardner.net> X-SA-Exim-Rcpt-To: ajoshi@nulinkinc.com, pgsql-admin@postgresql.org, pgsql-sql@postgresql.org X-SA-Exim-Scanned: No; SAEximRunCond expanded to false X-Archive-Number: 200306/272 X-Sequence-Number: 9263 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 20 June 2003 01:27, Anagha Joshi wrote: > Yes...I'm aware of that and have tried also by maintaining extra table. > But how to to the following: > 1. If insertion takes place, I want to return to the client the > values (with field names of course) which are inserted into the > tables. In each case table might be different. > When you insert a single row, PostgreSQL returns the OID of that row. Just= =20 follow up with a select (SELECT * FROM WHERE OID=3D) = and=20 you'll get all the info you need. > 2. If modification takes places, I want to know the values which > are modified with field names and return them to the client. > You can do that by checking what is different between the data you inserted= =20 and the data you get from the select statement. > More precisely, > My C++ client -- > ' > ' > " > Transcation begin > insert/update query to the backend is fired. > //control is tranferred to the trigger > //After trigger procedure is executed, I want at this > point the values inserted/modified so //as to pass them back > Transcation end > ' > ' > I don't think it can work the way you would like it. Try this algorithm. For insert: 1. Insert query is run. (Trigger, other table inserts/updates performed) 2. With the OID from the insert, select the data. For Update: 1. Update query is run. (Triggers, etc, are run as well). 2. With the OID (or Primary Key), select the data you just updated. You can turn these two procedures into a stored procedure pretty easily. Th= is=20 way, all you do is call a stored procedure, and it will pass back all the= =20 data you need. You get a free transaction block inside the stored procedure= =20 as well. - --=20 Jonathan Gardner (was jgardn@alumni.washington.edu) Live Free, Use Linux! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+8w95WgwF3QvpWNwRAsVgAKCu48FN0VkRvXc9a2d9Qc91YU6jaQCdG4h4 kH42h4oWrsh1f1Splm0KNkA=3D =3DzOMj -----END PGP SIGNATURE-----