PostgreSQL 9.3, :
DROP TABLE IF EXISTS files;
CREATE TABLE files(filename text);
COPY files FROM PROGRAM 'find /usr/bin -maxdepth 1 -type f -printf "%f\n"';
SELECT * FROM files ORDER BY filename ASC;
2000 81 , [ zip.
COPY . (.. ), (, postgres) :
CREATE OR REPLACE FUNCTION files()
RETURNS SETOF text AS
$BODY$
BEGIN
SET client_min_messages TO WARNING;
DROP TABLE IF EXISTS files;
CREATE TEMP TABLE files(filename text);
COPY files FROM PROGRAM 'find /usr/bin -maxdepth 1 -type f -printf "%f\n"';
RETURN QUERY SELECT * FROM files ORDER BY filename ASC;
END;
$BODY$
LANGUAGE plpgsql SECURITY DEFINER;
PostgreSQL non-superuser, :
SELECT * FROM files();
.
SECURITY DEFINER PostgreSQL , . , , , .
SET client_min_messages TO WARNING; PostgreSQL , . .
CREATE TEMP TABLE , . , TEMP.
'find...', /usr/bin/find, (type -f) , (-printf "%f\n"). , -maxdepth 1 - . . .
, , , . , PostgreSQL , , . , , . , .