Lo probe en una version mas anterior la 8.3.1 y salio todo bien.BTW: Mis mensajes estan llegando bastante retrasados al parecer estan necesitando aprobacion del administrador de la lista. Alvaro, puedes quitarme este problema.?
*-------------------------------------------------------* *-Edwin Quijada *-Developer DataBase *-JQ Microsistemas *-Soporte PostgreSQL *-www.jqmicrosistemas.com *-809-849-8087 *-------------------------------------------------------* > CC: pgsql-es-ayuda@postgresql.org > Subject: Re: [pgsql-es-ayuda] Errores con PK > From: alvhe...@alvh.no-ip.org > To: listas_quij...@hotmail.com > Date: Mon, 8 Aug 2011 22:25:08 -0400 > > Excerpts from Edwin Quijada's message of lun ago 08 19:29:00 -0400 2011: > > > > Hola!Estoy teniendo errores extranos con una clave primaria en > > PostgresTengo esta tabla > > CREATE TABLE "public"."t_factura_alquiler" ( "f_tipo" VARCHAR(10) NOT > > NULL, "f_numero" INTEGER DEFAULT 0 NOT NULL, "f_fecha" TIMESTAMP(0) > > WITHOUT TIME ZONE DEFAULT now() NOT NULL, "f_id_cliente" INTEGER DEFAULT > > 0, "f_ncf" VARCHAR(20), "f_monto" NUMERIC(15,2) DEFAULT 0 NOT NULL, > > "f_tax" NUMERIC(15,2) DEFAULT 0 NOT NULL, "f_balance" NUMERIC(15,2) > > DEFAULT 0 NOT NULL, "f_hechopor" INTEGER DEFAULT 0 NOT NULL, "f_pagada" > > BOOLEAN DEFAULT false NOT NULL, "f_descu" NUMERIC(15,2), CONSTRAINT > > "t_factura_alquiler_pkey" PRIMARY KEY("f_tipo", "f_numero"), CONSTRAINT > > "t_factura_alquiler_fk" FOREIGN KEY ("f_id_cliente") REFERENCES > > "public"."t_clientes"("f_id") ON DELETE NO ACTION ON UPDATE CASCADE > > NOT DEFERRABLE) WITH OIDS; > > > > --- Insertinsert into > > public.t_factura_alquiler(f_tipo,f_numero,f_id_cliente,f_monto) > > VALUES('FDD',1,1,300); > > -- ErrorERROR: duplicate key value violates unique constraint > > "t_factura_alquiler_pkey"ERROR: duplicate key value violates unique > > constraint "t_factura_alquiler_pkey" > > > > -- > > version------------------------------------------------------------------------------------- > > PostgreSQL 8.3.7 on i686-pc-linux-gnu, compiled by GCC gcc (Debian > > 4.3.2-1.1) 4.3.2(1 row) > > --db_alquipller=# select * from public.t_factura_alquiler where f_tipo = > > 'FDD' and f_numero = 1; f_tipo | f_numero | f_fecha | f_id_cliente | f_ncf > > | f_monto | f_tax | f_balance | f_hechopor | f_pagada | > > f_descu--------+----------+---------+--------------+-------+---------+-------+-----------+------------+----------+---------(0 > > rows) > > > > No se como me dice que esta duplicada la clave si no hay nada en esta tabla. > > Es bien raro. Deberías actualizar a 8.3.15 y si quieres simplemente > arreglar el problema hacerle reindex a esa tabla (o truncate). > > Si me pasas los archivos de la tabla y el índice a lo mejor puedo > mirarlos para ver cuál es el problema. > > -- > Álvaro Herrera <alvhe...@alvh.no-ip.org> > - > Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org) > Para cambiar tu suscripci�n: > http://www.postgresql.org/mailpref/pgsql-es-ayuda