Function Creation Error
От | Joshua Kramer |
---|---|
Тема | Function Creation Error |
Дата | |
Msg-id | Pine.LNX.4.64.0704070035520.29294@localhost.localdomain обсуждение исходный текст |
Ответы |
Re: Function Creation Error
|
Список | 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 по дате отправления: