Search Postgresql Archives

passing strings to functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't understand how to pass strings to functions.

create type tSession
  as
(
    SessionCode char(32),
    SessionID char(32),
    UserIDI integer,
    SessionN integer
);

create or replace function GetSessionCode( char(32), smallint,
boolean, varchar(128) )	returns tSession as
'
declare
  newSession tSession;
...
begin
...
  return newSession;
end;
' language plpgsql;

test1=# select * from
GetSessionCode('12345678901234567890123456789012',1,TRUE,'sadas');

ERROR: function getsessioncode("unknown", integer, boolean,"unknown")
does not exist HINT:  No function matches the given name and argument
types. You may need to add explicit type casts.

Is there a simpler way than casting everytime?

Curiously this work:

create or replace function testa( char(10) )
	returns char(32) as
'
begin
	return md5(''aaaa'');
end;
' language plpgsql;

test1=# select * from testa('dsd');
              testa
----------------------------------
 74b87337454200d4d33f80c4663dc5e5
(1 row)


thx

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux