Re: how to overwrite tuples in a table
От | Oliver Fromme |
---|---|
Тема | Re: how to overwrite tuples in a table |
Дата | |
Msg-id | 200409101547.i8AFlPpi010977@lurza.secnetix.de обсуждение исходный текст |
Ответ на | Re: how to overwrite tuples in a table ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>) |
Ответы |
Re: how to overwrite tuples in a table
|
Список | pgsql-novice |
"Pradeepkumar, Pyatalo (IE10)" wrote: > No I am not looking for UPDATE command.For updating first i should check if > there is a tuple with the given pointid and attributeid, if present then i > should use the UPDATE command.....thats fine. But what I wanted was a > situation wherein, I will blindly call the insert command and the database > takes care of overwriting the previous values.....is that possible. I suggest you just try the UPDATE command, and if that fails, perform an INSERT. You have to lock the table, in case another process is trying to do the same thing at the same time. (Unfortunately, you cannot use a transaction, because the failing UPDATE would abort the transaction. However, I believe the nested-transaction feature of PostgreSQL 8 (still in beta) would allow to do such things. Someone please correct me if I'm wrong ...) Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind." -- Alan Kay, OOPSLA '97
В списке pgsql-novice по дате отправления: