|
|
|
|
|
by e12e
1029 days ago
|
|
> So the way that we enforce it, is that we only generate SELECT queries, and do a post process verification to make sure that the result is actually only a read-only query. 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'); |
|