From: | "Bjorn T Johansen" <btj(at)havleik(dot)no> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Updating an emty table? |
Date: | 2003-06-25 08:40:16 |
Message-ID: | 46175.193.212.14.12.1056530416.squirrel@www.havleik.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi..
I have a small "problem" and I was wondering if you guys could give me a
recommendation. I have a table that initially is empty but the table is
always updated, so there is no insert first then update..
The table can hold 10-20 records for each order, and I was wondering how
to implement this update. There are two alternatives as far as I can
see..:
1. I can delete every row for the order on every update and do an insert
instead.
2. or I can write a function (stored proc) that first tries to update
and if update fails, it then does an insert.
The first one I know how to do (don't know how much penalty this would
cause?) and the second one is perhaps the best way to do it, but since I
have never written any stored proc for PostgreSQL yet, I need some
pointers on how to implement this...
Regards,
BTJ
-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
btj(at)havleik(dot)no Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91 N-1338 Sandvika
Cellular : +47 926 93 298 http://www.havleik.no
-----------------------------------------------------------------------------------------------
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
-----------------------------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Christophe ARNU (JX) | 2003-06-25 08:40:35 | pg_statistic_relid_att_index |
Previous Message | Ivar | 2003-06-25 07:39:07 | Re: bytea char escaping |