Insert Table from Execute String Query

İlyas Derse <[email protected]>
Newsgroups gmane.comp.db.postgresql.general
Message-ID <CALcdmyRo4=n6WTtb7NJcHAWzwJ6yDa1GhAaJkB3FGXyE9UbfXA@mail.gmail.com>
I need to insert temp table from execute string query. How can I do ? I'm
trying like that but not working.

CREATE OR REPLACE FUNCTION public.testdyn
(
        x integer
)
RETURNS TABLE
(
        id bigint,
        text character varying(4000)
)
AS $$
        DECLARE mysql TEXT;
BEGIN
        create temp table tmp1
(
id1 bigint,
text character varying(4000)
);
mysql = 'select id, text from TEST';

RETURN QUERY
      EXECUTE mysql INTO tmp1 ;
END;
$$ LANGUAGE plpgsql;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.