I have a function that returns a record
CREATE OR REPLACE FUNCTION atPeriod(
IN segment segmentST,
IN period period,
OUT n integer,
OUT s segmentST,
OUT p pointST)
RETURNS record AS
'$libdir/Hermes', 'atPeriodSegmentSTV1'
LANGUAGE c STABLE STRICT
COST 1;
I call that function in another function
CREATE OR REPLACE FUNCTION distance(seg1 segmentST, seg2 segmentST) RETURNS realTS AS
$BODY$
DECLARE
projseg1 record;
projseg2 record;
BEGIN
SELECT atPeriod(seg1,p) INTO projseg1;
SELECT atPeriod(seg2,p) INTO projseg2;
IF (projseg1).n = 2 AND (projseg2).n = 2 THEN
...
END IF;
END;
$BODY$ LANGUAGE plpgsql;
When I execute the second function I receive the error
********** Error **********
ERROR: record "projseg1" has no field "n"
SQL state: 42703
If instead I call the first function in a SQL statement
WITH Rec AS (
select 2 as seg_id, atPeriod(SegmentST(
pointst('2012-01-01 08:00:00', 1, 2),
pointst('2012-01-01 08:02:00', 2, 2)),
period('2012-01-01 08:00:00', '2012-01-01 08:01:00')
) as seg
)
Select (seg).n from rec
I receive the value 2 and no error.
Any hint how to solve this issue ?
n'a pas pu identifier la colonne « n » dans le type de données de l'enregistrementgit grep -B 4 -A 4 'pas pu identifier la colonne'shows that it's the message-templatecould not identify column \"%s\" in record data typefromparser/parse_expr.c:407