Re: INSERT ON DUPLICATE KEY UPDATE
От | Karsten Hilbert |
---|---|
Тема | Re: INSERT ON DUPLICATE KEY UPDATE |
Дата | |
Msg-id | 20040619182006.A988@hermes.hilbert.loc обсуждение исходный текст |
Ответ на | Re: INSERT ON DUPLICATE KEY UPDATE (Eduardo Pérez Ureta <eperez@it.uc3m.es>) |
Список | pgsql-general |
On Fri, Jun 18, 2004 at 08:36:21PM +0000, Eduardo Pérez Ureta wrote: > > On 2004-06-18 18:02:18 UTC, Richard Huxton wrote: > > Out of curiosity, why don't you know whether you're inserting or > > updating? It always worries me when I don't know what my application is > > doing. > > This is the example: > > I'm downloading a list of products from the web and they already have a > product_id (that's the primary key), in my table I have many fields that > I use myself like comments, stock, ... But when downloading the list I > only have the product_id, the product name, the price and the remote > stock. So I must insert data like the remote stock without removing any > of my data and leaving all the other columns unmodified. This smells of that you shouldn't use the product_id as your primary key (I know, this won't solve your problem as the insert will still fail since most likely you'll want product_id to be unique regardless of primary-key-ness). Just a thought. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
В списке pgsql-general по дате отправления: