From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | mihares(at)gmail(dot)com |
Subject: | BUG #15205: ERROR: table row type and query-specified row type do not match |
Date: | 2018-05-17 20:11:42 |
Message-ID: | 152658790263.1316.16727510031290766904@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15205
Logged by: Alexander Szwako
Email address: mihares(at)gmail(dot)com
PostgreSQL version: 9.6.1
Operating system: Linux
Description:
CREATE TABLE pedidos (
pedido numeric(12) NOT NULL,
comercio int8 NOT NULL,
id_pedido_comercio varchar(64) NOT NULL,
estado_transaccion int2 NOT NULL,
descripcion text NULL,
hash varchar(64) NOT NULL,
fecha_maxima_pago timestamp NOT NULL,
datos jsonb NOT NULL,
forma_pago int2 NOT NULL,
documento varchar(30) NULL, -- CI o documento
tipo_documento int2 NULL, -- Tipo de documento CI/RUC
monto numeric(12,2) NOT NULL,
divisa int2 NOT NULL,
fecha_creacion timestamp NOT NULL DEFAULT now(),
tipo_venta int2 NOT NULL,
porcentaje_comision numeric(5,2) NOT NULL,
monto_comision numeric(12,2) NOT NULL DEFAULT 0,
ranking_generado bool NULL DEFAULT false,
entorno int2 NOT NULL,
tipo_pedido int4 NOT NULL DEFAULT 1,
origen text NULL,
aviso_comercio bool NULL DEFAULT false, -- Si se aviso al comercio despues
del pago
fecha_aviso timestamp NULL, -- Fecha de aviso del pago al comercio
CONSTRAINT pk_pedidos PRIMARY KEY (pedido)
) ;
function definition
CREATE OR REPLACE FUNCTION fn_pedidos_respuestas_log2(
_hash_pedido character varying,
_codigo_respuesta varchar)
RETURNS void
LANGUAGE sql
SECURITY DEFINER
AS $function$
-- anular consulta de pedido en caso que sea 200
update pedidos set fecha_aviso = now(), aviso_comercio = true
where hash = $1 and aviso_comercio = false and $2='200'::Varchar;
$function$;
Query
select fn_pedidos_respuestas_log2(
_hash_pedido:='b8fd48d09c8141224f1461a4390a7fafcc6396cc189f8217210f6bb548d7dd23'::character
varying,
_codigo_respuesta:='200'::character varying(10)) as data;
Error:
SQL Error [42804]: ERROR: table row type and query-specified row type do
not match
Detail: Query provides a value for a dropped column at ordinal position
17.
Where: SQL function "fn_pedidos_respuestas_log2" statement 1
Query info:
select *
from pg_attribute
where attrelid='pedidos'::regclass;
attrelid attname atttypid attstattarget attlen attnum attndims attcacheoff atttypmod attbyval attstorage attalign attnotnull atthasdef attisdropped attislocal attinhcount attcollation attacl attoptions attfdwoptions
17239 tableoid 26 0 4 -7 0 -1 -1 true p i true false false true 0 0 NULL NULL NULL
17239 cmax 29 0 4 -6 0 -1 -1 true p i true false false true 0 0 NULL NULL NULL
17239 xmax 28 0 4 -5 0 -1 -1 true p i true false false true 0 0 NULL NULL NULL
17239 cmin 29 0 4 -4 0 -1 -1 true p i true false false true 0 0 NULL NULL NULL
17239 xmin 28 0 4 -3 0 -1 -1 true p i true false false true 0 0 NULL NULL NULL
17239 ctid 27 0 6 -1 0 -1 -1 false p s true false false true 0 0 NULL NULL NULL
17239 pedido 1700 -1 -1 1 0 -1 786436 false m i true true false true 0 0 NULL NULL NULL
17239 comercio 20 -1 8 2 0 -1 -1 true p d true false false true 0 0 NULL NULL NULL
17239 id_pedido_comercio 1043 -1 -1 3 0 -1 68 false x i true false false true 0 100 NULL NULL NULL
17239 estado_transaccion 21 -1 2 4 0 -1 -1 true p s true false false true 0 0 NULL NULL NULL
17239 descripcion 25 -1 -1 5 0 -1 -1 false x i false false false true 0 100 NULL NULL NULL
17239 hash 1043 -1 -1 6 0 -1 68 false x i true false false true 0 100 NULL NULL NULL
17239 fecha_maxima_pago 1114 -1 8 7 0 -1 -1 true p d true false false true 0 0 NULL NULL NULL
17239 datos 3802 -1 -1 8 0 -1 -1 false x i true false false true 0 0 NULL NULL NULL
17239 forma_pago 21 -1 2 9 0 -1 -1 true p s true false false true 0 0 NULL NULL NULL
17239 documento 1043 -1 -1 10 0 -1 34 false x i false false false true 0 100 NULL NULL NULL
17239 tipo_documento 21 -1 2 11 0 -1 -1 true p s false false false true 0 0 NULL NULL NULL
17239 monto 1700 -1 -1 12 0 -1 786438 false m i true false false true 0 0 NULL NULL NULL
17239 divisa 21 -1 2 13 0 -1 -1 true p s true false false true 0 0 NULL NULL NULL
17239 fecha_creacion 1114 -1 8 14 0 -1 -1 true p d true true false true 0 0 NULL NULL NULL
17239 tipo_venta 21 -1 2 15 0 -1 -1 true p s true false false true 0 0 NULL NULL NULL
17239 porcentaje_comision 1700 -1 -1 16 0 -1 327686 false m i true false false true 0 0 NULL NULL NULL
17239 ........pg.dropped.17........ 0 0 -1 17 0 -1 786438 false m i false false true true 0 0 NULL NULL NULL
17239 monto_comision 1700 -1 -1 18 0 -1 786438 false m i true true false true 0 0 NULL NULL NULL
17239 ranking_generado 16 -1 1 19 0 -1 -1 true p c false true false true 0 0 NULL NULL NULL
17239 entorno 21 -1 2 20 0 -1 -1 true p s true false false true 0 0 NULL NULL NULL
17239 tipo_pedido 23 -1 4 21 0 -1 -1 true p i true true false true 0 0 NULL NULL NULL
17239 origen 25 -1 -1 22 0 -1 -1 false x i false false false true 0 100 NULL NULL NULL
17239 aviso_comercio 16 -1 1 23 0 -1 -1 true p c false true false true 0 0 NULL NULL NULL
17239 fecha_aviso 1114 -1 8 24 0 -1 -1 true p d false false false true 0 0 NULL NULL NULL
This column:
17239 ........pg.dropped.17........ 0 0 -1 17 0 -1 786438 false m i false false true true 0 0 NULL NULL NULL
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-05-17 20:15:33 | Re: BUG #15205: ERROR: table row type and query-specified row type do not match |
Previous Message | Alvaro Herrera | 2018-05-17 16:36:31 | Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column |