Function Creation Error - Mailing list pgsql-novice

From Joshua Kramer
Subject Function Creation Error
Date
Msg-id Pine.LNX.4.64.0704070035520.29294@localhost.localdomain
Whole thread Raw
Responses Re: Function Creation Error
List pgsql-novice
Hello all,

I have a function definition built with pgadmin3 that looks like this:

CREATE FUNCTION "fnGenerateAuthTicket"(p_ticket_serial character varying,
p_expire_hours integer, p_user_id integer, p_ip_addr inet) RETURNS
character varying AS
$BODY$
insert into auth_tickets(user_id, expire_datetime, init_datetime,
init_ip_addr, ticket_serial)
         values (p_user_id, now() + interval 'p_expire_hours
hours', now(), p_ip_addr, p_ticket_serial);
$BODY$
LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "fnGenerateAuthTicket"(character varying, integer, integer,
inet) OWNER TO prod_user;

pgadmin3 gives me an error, "Error: column p_user_id does not exist at
character 280".  The function examples I've seen show that you use the
variable parameter names just like normal fields, and that's what I'm
doing here.  I'm not sure where the error comes from.

Also, is my use of interval correct?  I want to have a parameter with
number of hours to expire, but I'm not sure how to make sure that the
'p_expire_hours hours' is interpreted as, say, '2 hours' instead of the
literal itself 'p_expire_hours hours'.

Thanks,
-Josh


pgsql-novice by date:

Previous
From: Michelle Konzack
Date:
Subject: Re: Anyone know where I can get an 8.2.3 binary for ubuntu?
Next
From: Tom Lane
Date:
Subject: Re: Function Creation Error