| From: | Harald Fuchs <nospam(at)sap(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Replaceing records |
| Date: | 2003-09-04 15:22:41 |
| Message-ID: | pu8yp4pohq.fsf@srv.protecting.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
In article <87ekywbqz1(dot)fsf(at)stark(dot)dyndns(dot)tv>,
Greg Stark <gsstark(at)mit(dot)edu> writes:
> Out of curiosity, what does the mysql syntax look like? How would you handle
> something where the insert and update were quite different like:
> INSERT INFO foo (pk,value,count,date_ins) values (?,?,1,now())
> OR UPDATE foo set value=?, count=count+1, date_upd=now() where pk = ?
You can't. The only thing MySQL has to offer is
REPLACE INTO tbl_name [(col_name,...)] VALUES (expr,...)
`REPLACE' works exactly like `INSERT', except that if an old record in
the table has the same value as a new record on a `UNIQUE' index or
`PRIMARY KEY', the old record is deleted before the new record is
inserted.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josué Maldonado | 2003-09-04 15:27:51 | Re: TCL trigger doesn't work after deleting a column |
| Previous Message | Tom Lane | 2003-09-04 15:21:05 | Re: TCL trigger doesn't work after deleting a column |