Re: Error borrando datos de tabla en 8.3

From: Raúl Andrés Duque <raulandresduque(at)hotmail(dot)com>
To: Raúl Andrés Duque <ra_duque(at)yahoo(dot)com(dot)mx>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Error borrando datos de tabla en 8.3
Date: 2008-02-29 10:47:03
Message-ID: BAY135-DAV14EFF7FDC931125A9CCA87BA140@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

>
>----- Original Message -----
>From: Raúl Andrés Duque
>To: pgsql-es-ayuda(at)postgresql(dot)org
>Sent: Friday, February 29, 2008 5:13 AM
>Subject: [pgsql-es-ayuda] Error borrando datos de tabla en 8.3
>
>
>Cordial Saludo.
>
>Tengo que inicializar una tabla por lo que ejecute los siguientes comandos:
>
>==================================================================
>-- Limpiar Movimiento
>delete from def_movimiento;
>select setval('def_movimiento_id_movimiento_seq', 1);
>==================================================================
>
>La tabla tiene cerca de 500k registros ... después de 6 horas decidí
>cancelar el comando (no era lógico que demorara tanto!!!), al cancelar
>obtuve el siguiente >mensaje:
>
>==================================================================
>Query result with 1 rows discarded.
>Query result with 1 rows discarded.
>Query result with 1 rows discarded.
>Query result with 1 rows discarded.
>Query result with 1 rows discarded.
>
>ERROR: canceling statement due to user request
>CONTEXT: SQL statement "SELECT 1 FROM ONLY "postgresql"."def_parte" x
>WHERE "id_parte" OPERATOR(pg_catalog.=) $1 FOR SHARE OF x"
>==================================================================
>
>Existe un FK entre def_movimiento y def_parte, pero por el sentido de la
>relación, no debería afectarme .... además las operaciones en cascada están
> >desactivadas.
>
>Qué puede estar pasando?
>
>NOTA: En 8.2 no tuve problemas en este sentido. Voy a intentar con TRUNCATE
>TABLE, que es más adecuado para lo que quiero hacer a ver que pasa.
>
>Esta es la estructura de la tabla def_movimiento:
>
>==================================================================
>CREATE TABLE postgresql.def_movimiento
>(
> id_movimiento integer NOT NULL DEFAULT
> nextval('def_movimiento_id_movimiento_seq'::regclass),
> fecha_movimiento timestamp without time zone NOT NULL DEFAULT
> ('now'::text)::date,
> id_transac integer NOT NULL DEFAULT 1,
> id_dtransac smallint NOT NULL DEFAULT 1,
> id_traninve integer NOT NULL DEFAULT 1,
> id_parte integer NOT NULL DEFAULT 1,
> id_almacen integer NOT NULL DEFAULT 1,
> id_localizacion integer NOT NULL DEFAULT 1,
> id_tipodocumento integer NOT NULL DEFAULT 99,
> documento_movimiento integer NOT NULL DEFAULT 0,
> itemdocu_movimiento smallint NOT NULL DEFAULT 0,
> id_tercero integer NOT NULL DEFAULT 99999999,
> iduser integer NOT NULL DEFAULT 1,
> id_unidad integer NOT NULL DEFAULT 1,
> cantidad_movimiento real NOT NULL DEFAULT 0,
> vpromedio_movimiento real NOT NULL DEFAULT 0,
> vultimo_movimiento real NOT NULL DEFAULT 0,
> qreal_movimiento real NOT NULL DEFAULT 0,
> qcomprometida_movimiento real NOT NULL DEFAULT 0,
> qtransito_movimiento real NOT NULL DEFAULT 0.0,
> qreal2_movimiento real NOT NULL DEFAULT 0.0,
> CONSTRAINT key_movimiento PRIMARY KEY (id_movimiento),
> CONSTRAINT def_movimiento_id_almacen_fkey FOREIGN KEY (id_almacen,
> id_localizacion)
> REFERENCES postgresql.def_localizacion (id_almacen, id_localizacion)
> MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_parte_fkey FOREIGN KEY (id_parte)
> REFERENCES postgresql.def_parte (id_parte) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_tercero_fkey FOREIGN KEY (id_tercero)
> REFERENCES postgresql.def_tercero (id_tercero) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_tipodocumento_fkey FOREIGN KEY
> (id_tipodocumento)
> REFERENCES postgresql.def_tipodocumento (id_tipodocumento) MATCH
> SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_traninve_fkey FOREIGN KEY (id_traninve)
> REFERENCES postgresql.def_traninve (id_traninve) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_transac_fkey FOREIGN KEY (id_transac,
> id_dtransac)
> REFERENCES postgresql.def_dtransac (id_transac, id_dtransac) MATCH
> SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_id_unidad_fkey FOREIGN KEY (id_unidad)
> REFERENCES postgresql.def_unidad (id_unidad) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION,
> CONSTRAINT def_movimiento_iduser_fkey FOREIGN KEY (iduser)
> REFERENCES postgresql.sys_users (iduser) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION
>)
>WITH (OIDS=FALSE);
>ALTER TABLE postgresql.def_movimiento OWNER TO postgres;
>
>CREATE INDEX idx_movimiento_fecha
> ON postgresql.def_movimiento
> USING btree
> (fecha_movimiento);
>==================================================================
>
>El archivo de log no me reporta ningun problema de memoria, sin envargo me
>recomienda aumentar el tiempo de checkpoints;
>
>==================================================================
>2008-02-29 04:04:07 COT LOG: checkpoints are occurring too frequently (15
>seconds apart)
>2008-02-29 04:04:07 COT HINT: Consider increasing the configuration
>parameter "checkpoint_segments".
>2008-02-29 04:04:26 COT LOG: checkpoints are occurring too frequently (19
>seconds apart)
>2008-02-29 04:04:26 COT HINT: Consider increasing the configuration
>parameter "checkpoint_segments".
>2008-02-29 04:04:39 COT LOG: checkpoints are occurring too frequently (13
>seconds apart)
>2008-02-29 04:04:39 COT HINT: Consider increasing the configuration
>parameter "checkpoint_segments".
>2008-02-29 04:44:54 COT LOG: loaded library
>"$libdir/plugins/plugin_debugger.dll"
>2008-02-29 04:45:54 COT LOG: loaded library
>"$libdir/plugins/plugin_debugger.dll"
>2008-02-29 04:45:54 COT ERROR: canceling statement due to user request
>2008-02-29 04:45:54 COT CONTEXT: SQL statement "SELECT 1 FROM ONLY
>"postgresql"."def_parte" x WHERE "id_parte" OPERATOR(pg_catalog.=) $1 FOR
>SHARE OF x"
>2008-02-29 04:45:54 COT STATEMENT: -- Limpiar Movimiento
>
> delete from def_movimiento;
>
> select setval('def_movimiento_id_movimiento_seq', 1);
>
>2008-02-29 04:47:03 COT LOG: loaded library
>"$libdir/plugins/plugin_debugger.dll"
>2008-02-29 04:47:36 COT LOG: loaded library
>"$libdir/plugins/plugin_debugger.dll"
>2008-02-29 05:06:17 COT LOG: loaded library
>"$libdir/plugins/plugin_debugger.dll"
>==================================================================
>
>
>Atentamente,
>
>RAUL DUQUE
>Bogotá, Colombia

El TRUNCATE TABLE funcionó bien, sinembargo me queda la duda del porque del
error con delete.

Atentamente,

RAUL DUQUE
Bogotá, Colombia

__________ Information from ESET Smart Security, version of virus signature
database 2908 (20080228) __________

The message was checked by ESET Smart Security.

http://www.eset.com

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Manolo _ 2008-02-29 11:11:14 RE: Runs y Logical Tapes
Previous Message Raúl Andrés Duque 2008-02-29 10:13:56 Error borrando datos de tabla en 8.3