Table name as variable parameter
问题 I made a function in pgadmin create or replace function get_source2(a text) returns integer as $$ declare a text; geom geometry; begin select get_source(geom) from a; end; $$ language plpgsql; I want input a by table name How can I do? I try to like this select get_source2('postgis.center') but I get: ERROR: relation "a" does not exist LINE 2: from a help me 回答1: try this: create or replace function get_source2(a text) returns integer as $$ declare geom geometry; begin execute 'select get