Re: PL/pgSQL examples NOT involving functions
От | Josh Berkus |
---|---|
Тема | Re: PL/pgSQL examples NOT involving functions |
Дата | |
Msg-id | web-507249@davinci.ethosmedia.com обсуждение исходный текст |
Ответ на | Re: PL/pgSQL examples NOT involving functions (Roland Roberts <roland@astrofoto.org>) |
Ответы |
Re: PL/pgSQL examples NOT involving functions
|
Список | pgsql-sql |
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 informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
В списке pgsql-sql по дате отправления: