postgresql - In postgres (plpgsql), how to make a function that returns select * on a variable table_name? -


Actually, at least for proof of concept, I want to do a task where I can run: SELECT Res ('Table_name'); And this will give me the result of selection - from table_name; The problem I have is the schema ... Function is in the announcement I:

Make the function ridge (table_name text) or re-replace SETOF as the THISISTHEPROBLEM AS

The problem That I do not know how to declare my return, because it wants to specify me a table or schema, and I will not be as long as the function does not really work.

Any thoughts?

You can do this, but as you see a column definiton list SELECT Query.

  create or save session function (table_name text) return $$ as cellphone record QUERY EXECUTE 'SELECT * FROM' table name; End; $$ LANGUAGE plpgsql; For some time (select 'sometime') (section 1), select the section (call 1 Integer, Cola2 Integer, Cole 3 Smalling, Cole 4 Text);   



Comments