From: | Edwin Quijada <listas_quijada(at)hotmail(dot)com> |
---|---|
To: | <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Errores con PK |
Date: | 2011-08-08 23:29:00 |
Message-ID: | BAY155-w3989526B7E0582B020BA15E3210@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
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.
*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-Soporte PostgreSQL
*-www.jqmicrosistemas.com
*-809-849-8087
*-------------------------------------------------------*
From | Date | Subject | |
---|---|---|---|
Next Message | Alejandro Soto De las Cuevas | 2011-08-08 23:40:51 | Subir un excel que esta en FTP a una tabla de motor Postgresql |
Previous Message | Jaime Casanova | 2011-08-08 20:31:21 | Re: mantenimientos programados |