Re: It is possible to update more than 1 table in the same update statement?

From: Andre Lopes <lopes80andre(at)gmail(dot)com>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
Cc: 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-09 00:39:41
Message-ID: AANLkTin6RYyhXbAuewveOrsvFBP97utJJZRCCUsfgL+X@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Thanks for the reply.

I have write the transaction, but I have some doubt's... If in this example
the Update is executed successfully and the Function it is not, what
happens? The Update automatically rolls back?

Example:

[code]
Begin;
update aae_anuncios
set
n_anunciante = 'teste',
email = 'teste(at)email(dot)com',
telefone_privado = '123456789',
dat_nasc = '1980-01-01',
n_anuncio = 'teste nome',
telefone_anuncio = '234567890',
id_genero = 'femi',
id_cidade = '1452003',
id_nacionalidade = 'BRAS',
id_orientacao = 'h'
where id_anuncio_externo = '38';

select apr_update_hist_2_1('aae_hist_anuncios',
'id_anuncio_externo',
'38', /* id_anuncio_externo */
'2010-08-31', /* data_inicio */
'2010-12-29', /* data_fim */
'AA' /* Motivo: Aprovação Anúncio */
);
commit;
[/code]

Best Regards,

On Sun, Nov 7, 2010 at 3:41 PM, Scott Ribe <scott_ribe(at)killerbytes(dot)com>wrote:

> On Nov 7, 2010, at 8:37 AM, Andre Lopes wrote:
>
> > The only way I can guarantee a transaction is in a Function or there are
> other ways?
>
> <http://www.postgresql.org/docs/9.0/interactive/tutorial-transactions.html
> >
>
> --
> Scott Ribe
> scott_ribe(at)elevated-dev(dot)com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2010-11-09 00:56:45 Re: It is possible to update more than 1 table in the same update statement?
Previous Message Scott Marlowe 2010-11-08 23:55:56 Re: Full Vacuum/Reindex vs autovacuum