sql - Creating functions in postgresql -


i new sql, please try not overly critical question, need create function return me table (say example "machine") , have column called "aggtablename" , rows filled values derived database. here tried , following error came....so please me in making syntax correct, thanks..

create function aggtable() returns table (machineid, serveraggtablename) $table$   begin        return query       select m.machineid, m.serveraggtablename      machine m     end;   $table$   language plpgsql;    select aggtable(); 

error: function aggtable() not exist line 1: select aggtable(); ^ hint: no function matches given name , argument types. might need add explicit type casts.

the arguments of table you're returning not have type.

try adding type such machineid int.

check post

how can postgres stored function return table


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -