I have a function in PostgreSQL / plpgsql with the following signature:
CREATE OR REPLACE FUNCTION user_login(TEXT, TEXT) RETURNS SETOF _get_session AS $$ ... $$
Where _get_session is the view. The function works fine when called from phpPgAdmin, however, as I call it with PHP, I get the following error:
Warning: pg_query () [function.pg-query]: query failed: ERROR: type "session_ids" does not exist CONTEXT: compilation of the PL / pgSQL function "user_login" near line 2 in /home/sites/blah.com/index. php on line 69
The DECLARE section of the function contains the following variables:
oldSessionId session_ids := $1; newSessionId session_ids := $2;
The session_ids domain exists, and other functions that use the same domain work when called from the same script. PHP is as follows:
$query = "SELECT * FROM $dbschema.user_login('$session_old'::TEXT, '$session'::TEXT)"; $result = pg_query($login, $query);
I also tried this using ::session_ids instead of ::TEXT when calling the function, however I get the same error.
Help: o (
source share