Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAG0JRm65796 for ; Thu, 15 Nov 2001 19:19:28 -0500 (EST) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.7) with HTTP id 507249; Thu, 15 Nov 2001 16:19:23 -0800 From: "Josh Berkus" Subject: Re: PL/pgSQL examples NOT involving functions To: Roland Roberts , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.7 Date: Thu, 15 Nov 2001 16:19:23 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200111/233 X-Sequence-Number: 5615 Roland, > Hmm, there were some complaints recently on the hackers list about > things being posted on only one list. And a significant chunk of the > mail I am getting from lists shows it was posted to more than one > list. Yeah, and you'll notice me saying "please don't cross-post" a lot. Basically I'm trying to encourage people to NOT cross-post because we end up with a lot of questions being answered 2 and 3 times on different lists. It's really not fair to the people who are trying to be helpful and answer questions. Hackers is one of the lists I am not subscribed to (I currently read SQL, NOVICE, PHP and ANNOUNCE). > So how would I convert an insert to an update when I detect a tuple > is > already present in the database? Do I have to write the whole thing > in Perl/Tcl/whatever and do the conversion there? Yes. Use the EXECUTE method. Or do it in your middleware. Or establish a unique index, do both an insert and an update, and ignore the error messages. Or ... if you wanna get really tricky ... write some triggers to do the substitution. Personally, I find that keeping track, on the client side, of whether you're adding a new record or editing an old one and acting appropriately is better than trying to second-guess it on the database level, but maybe that's just me. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco