| From: | Andre Lopes <lopes80andre(at)gmail(dot)com> |
|---|---|
| To: | Szymon Guz <mabewlun(at)gmail(dot)com> |
| Cc: | Scott Ribe <scott_ribe(at)killerbytes(dot)com>, postgresql Forums <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: It is possible to update more than 1 table in the same update statement? |
| Date: | 2010-11-07 15:37:35 |
| Message-ID: | AANLkTikedZZrk4LHLZpjisFd3wzeNdb3_pB0=hhBKafP@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
The only way I can guarantee a transaction is in a Function or there are
other ways?
Best Regards,
On Sun, Nov 7, 2010 at 3:22 PM, Szymon Guz <mabewlun(at)gmail(dot)com> wrote:
>
>
> On 7 November 2010 16:20, Andre Lopes <lopes80andre(at)gmail(dot)com> wrote:
>
>> Sorry for not explain well.
>>
>> I mean update more than one table at the same time with something like
>> this:
>>
>> update table1, table2
>> set
>> table1.f1 = 'aaa',
>> table2.date = '2001-01-01'
>> where
>> table1.id = 'x1' and table2.id = 'x1'
>>
>> Something like this is possible? It is the best way to do it?
>>
>> Best Regards,
>>
>>
> This is not possible, however you could do two updates in one transaction.
>
> regards
> Szymon
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Ribe | 2010-11-07 15:41:49 | Re: It is possible to update more than 1 table in the same update statement? |
| Previous Message | Magnus Hagander | 2010-11-07 15:33:06 | Re: Run "postgresql\9.0\data" on a RAID-1 disk on my Local Area Network (LAN) |