Function Creation Error

From: Joshua Kramer <josh(at)globalherald(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Function Creation Error
Date: 2007-04-07 04:39:44
Message-ID: Pine.LNX.4.64.0704070035520.29294@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2007-04-07 04:53:51 Re: Function Creation Error
Previous Message Leonel 2007-04-06 16:37:08 Re: Anyone know where I can get an 8.2.3 binary for ubuntu?