Re: Serial / Secuencia

From: "Guillermo =?iso-8859-1?b?TXXxb3o=?=" <guillermo(dot)munoz(at)grupotekne(dot)com(dot)ar>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Omar Antonio Neyra Rodriguez <omarneyrarodriguez(at)gmail(dot)com>, MIGUEL CANCHAS <mcanchas(at)tsr(dot)com(dot)pe>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Serial / Secuencia
Date: 2007-10-24 16:01:46
Message-ID: 20071024130146.0cfb0y55c8sck0s8@webmail.vit4b.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Quoting Alvaro Herrera <alvherre(at)commandprompt(dot)com>:

> Omar Antonio Neyra Rodriguez escribió:
>> y que pasaria y antes de utilizar el currval alguien ha insertado otro
>> registro???
>> ¿Recuperaria el registro erroneo?
>
> Solamente te entrega el valor que tu sesion asigna. Si en otra sesion
> alguien hace un nextval(), eso no te afecta.

Es asi, el nextval y currval se manejan dentro de una transaccion. Si
vos haces
un nextval y al mismo tiempo otro usuario hace un nextval a cada uno le va a
asignar valores diferente y por ende currval les retornara valores diferente
sin a cada uno hasta que termine la transaccion o haya otro nextval dentro de
la transaccion. por eso no podes hacer un currval sin antes hacer un nextval

Saludos
Guillermo Muñoz

>
> --
> Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
> "If it wasn't for my companion, I believe I'd be having
> the time of my life" (John Dunbar)
> --
> TIP 2: puedes desuscribirte de todas las listas simultáneamente
> (envía "unregister TuDirecciónDeCorreo" a majordomo(at)postgresql(dot)org)
>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message José Fermín Francisco Ferreras 2007-10-24 17:01:32 paquete postgresql para Debian 4.0
Previous Message Martin Marques 2007-10-24 14:01:29 Re: Conexion a servidor Postgresql 8.1 y 8.2