Denis BUCHER wrote:
> Richard Huxton a écrit :
>> The other thing you could try is printing out row before returning it:
>> RAISE NOTICE 'row = %', row;
>> RETURN NEXT ROW;
>> It might be you've not got what you were expecting.
>
> Thanks a lot, good idea...
>
> But it looks good :
Hmm...
>> SELECT * FROM rma.test ('19G256259');
>> NOTICE: row = (12066602,19G256259,170224,PN6405B,2009-09-22,"FORERUNNER 405 NOIR",2009-09-22,15090,14748)
>> ERREUR: wrong record type supplied in RETURN NEXT
>> CONTEXTE : PL/pgSQL function "test" line 12 at return next
>>
>> \d rma.serial_number
>> Table « rma.serial_number »
>> Colonne | Type | Modificateurs
>> -------------+-----------------------+-------------------------------------------------------------------
>> sn_id | bigint | not null default nextval('rma.serial_number_sn_id_seq'::regclass)
>> sn | character varying(30) |
>> no_client | integer |
>> no_art_bw | character varying(11) |
>> sn_fc_date | date |
>> desc_fr | character varying(40) |
>> sn_cm_date | date |
>> no_facture | integer |
>> no_commande | integer |
I was wondering if maybe there was a bug to do with domains or complex
column types, but there's nothing out of the ordinary here.
OK - can you generate a test script with just CREATE TABLE, CREATE
FUNCTION, one INSERT and a function-call? I'll try and recreate it here.
Oh, and what version of PostgreSQL are we talking about?
-- Richard Huxton Archonet Ltd