1 -- CREATE SCHEMA unix_sql_api;
3 SET search_path TO unix_sql_api;
5 DROP VIEW IF EXISTS fstab;
6 DROP FUNCTION IF EXISTS fstab();
7 DROP TYPE IF EXISTS unix_sql_api_fstab;
9 CREATE TYPE unix_sql_api_fstab AS (
21 CREATE OR REPLACE FUNCTION fstab()
22 RETURNS SETOF unix_sql_api_fstab AS $$
26 open(FSTAB, "<", "/etc/fstab") or die $!;
29 if (/^([^\s#]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+(\d+)\s+(\d+)\s*$/) {
32 my $device_spec_value;
34 if ($1 =~ /([^=]+)=(.*)/) {
35 ($device_spec_type, $device_spec_value) = ($1, $2);
41 device_type => $device_spec_type,
42 device_value => $device_spec_value,
45 types => [split(",", $3)],
46 options => [split(",", $4)],
56 CREATE OR REPLACE VIEW fstab AS