Listing 9. PostgreSQL as a Filesystem

$ psql
# create database tmp;
# \c tmp
# create table foo ( message varchar(100) not null,
                    id int primary key );
# insert into foo values ( 'doki doki', 1 );
# \q

$ fls -0 pg://localhost/tmp/foo
doki doki 1       1       id

$ fcat pg://localhost/tmp/foo/1
<context  id="1"  message="doki doki"  />

$ echo "waku waku" | ferris-redirect \
  -T --ea=message pg://localhost/tmp/foo/1

$ fls -0 pg://localhost/tmp/foo
waku waku  1       1        id

$ gfcreate pg://localhost/tmp/foo
# See the gfcreate-tuple figure

$ fls -0 pg://localhost/tmp/foo
utsukushii  2       2        id

$ psql tmp;
# select * from foo;
        message         | id
------------------------+----
waku waku               |  1
utsukushii              |  2

