by alishobeiri · 3y ago · 0 comments
I think you have a great point though, this should be made much clearer so users can build trust in using the product. Thanks a lot for the feedback!
So it will select from functions?
CREATE OR REPLACE FUNCTION delete_all_from_table(_tbl regclass)
RETURNS integer AS
$func$
DECLARE
_r record;
_count integer = 0;
BEGIN
FOR _r IN
EXECUTE format('DELETE FROM %s RETURNING *', _tbl)
LOOP
_count := _count + 1;
END LOOP;
RETURN _count;
END
$func$ LANGUAGE plpgsql;
SELECT delete_all_from_table('users');