andrew andrew - 1 month ago 12
SQL Question

pgadmin, sql, function inputday by table name

I made a function im pgadmin

create or replace function get_source2(a text)

returns integer as


a text;

geom geometry;


select get_source(geom)

from a;



language plpgsql;

I want input a by table name
How can I do?
I try to like this

select get_source2('')
ERROR: relation "a" does not exist
LINE 2: from a
help me


You need to call it as part of a regular select statement:

select get_source(geom), name, place
from location;

But that will be very inefficient as you are running the select inside the function for each and every row in the location table.