Accessing function parameters within double quotes - Mailing list pgsql-general

From John Duffy
Subject Accessing function parameters within double quotes
Date
Msg-id 000601c2eefa$595c4890$6690fc3e@devel
Whole thread Raw
List pgsql-general
Hi
 
No matter what value of parameter I call the function below with, the value of $2 is always 2 within the addition operation. Is $2 inaccessible within the double quotes? If so how do I amend the function to get it to work?
 
CREATE FUNCTION get_data(DATE, INTEGER) RETURNS SETOF data AS '
DECLARE
    row    data%ROWTYPE;
BEGIN
    FOR row IN
        SELECT * FROM data
        WHERE startdate >= $1
        AND startdate <= $1 + interval ''$2 months''   
    LOOP
        RETURN NEXT row;
    END LOOP;
END;
' LANGUAGE 'plpgsql';
 
Regards
 
John Duffy

pgsql-general by date:

Previous
From: Vadim Menshakov
Date:
Subject: table function: limit, offset, order
Next
From: oraclej
Date:
Subject: Re: problem authenticating with encrypted passwords in pg_shadow