Looking to have the default INSERT INTO message where the count of records inserted is printed out. Know this has something to do with changing RETURNS from void to something else and possibly adding an OUT argument?
CREATE OR REPLACE FUNCTION etl(from_table regclass, to_table regclass) RETURNS void AS
$$
BEGIN
EXECUTE 'INSERT INTO ' || to_table || ' ('
'title'
') '
'SELECT '
'data->>''title'' as title'
'FROM ' || from_table || ' '
USING from_table, to_table;
END
$$ LANGUAGE plpgsql;
returningwill return the actual values, not the count of rows affectedUSINGclause is superfluous and should be remove.