Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Carga de Datos en base a COPY/INSERTS


  • From: "Luis D. García" <ldgarc(at)gmail(dot)com>
  • To: "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-es-ayuda(at)postgresql(dot)org
  • Subject: Re: Carga de Datos en base a COPY/INSERTS
  • Date: Thu, 31 Jul 2008 15:18:07 +1930
  • Message-id: <3de424340807301248v5411861q655e38e3a36c5c43(at)mail(dot)gmail(dot)com>


Claro, puedes hacer algo como

begin;
lock table tabla_principal;
insert into tabla_principal
select * from tabla_temporal where not exists (registro en tabla_principal)
commit;

El LOCK TABLE es necesario para el caso en que un registro se inserte en
la tabla principal mientras este proceso esta funcionando.

Bah... cómo no se me ocurrió eso antes jaja. No pensé en la posibilidad de utilizar SELECTS para mover los datos de una tabla a la otra.

Como siempre gracias por el dato Alvaro.

--
Luis D. García M.

Telf: (+58) 2418662663
Cel.: (+58) 4143482018


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group