New answers tagged

2

If you just need to look at something relative to $PGDATA you can use pg_ls_data SELECT pg_ls_dir('pg_xlog'); Otherwise, a simple function like this: CREATE OR REPLACE FUNCTION ls(location text) RETURNS text AS $BODY$ use warnings; use strict; my $location = $_[0]; my $output = `ls -l $location`; return($output); $BODY$ LANGUAGE ...


2

You can easily do what @a_horse_with_no_name suggests in his comment. But there is also an interesting way to do it, using PL/pgSQL as the function language. This uses a feature of the COPY command, introduced in PostgreSQL 9.3. It can now take a command as target/source, exactly where you'd use a filename or STDIN/STDOUT in normal cases: COPY ...



Top 50 recent answers are included