1.1 --- a/prototyp/prototyp.sql Tue Sep 02 00:06:04 2014 +0200
1.2 +++ b/prototyp/prototyp.sql Tue Sep 02 10:25:23 2014 +0200
1.3 @@ -28,15 +28,15 @@
1.4 DROP TYPE IF EXISTS unix_sql_api_fstab;
1.5
1.6 CREATE TYPE unix_sql_api_fstab AS (
1.7 - device VARCHAR,
1.8 - device_type VARCHAR,
1.9 - device_value VARCHAR,
1.10 - mount_point VARCHAR,
1.11 - type VARCHAR,
1.12 - types VARCHAR[],
1.13 - options VARCHAR[],
1.14 - dump INTEGER,
1.15 - pass INTEGER
1.16 + device VARCHAR,
1.17 + device_type VARCHAR,
1.18 + device_value VARCHAR,
1.19 + mount_point VARCHAR,
1.20 + type VARCHAR,
1.21 + types VARCHAR[],
1.22 + options VARCHAR[],
1.23 + dump INTEGER,
1.24 + pass INTEGER
1.25 );
1.26
1.27 CREATE OR REPLACE FUNCTION fstab()
1.28 @@ -88,9 +88,9 @@
1.29 DROP TYPE IF EXISTS unix_sql_api_groups;
1.30
1.31 CREATE TYPE unix_sql_api_groups AS (
1.32 - id INTEGER,
1.33 - name VARCHAR,
1.34 - members VARCHAR[]
1.35 + id INTEGER,
1.36 + name VARCHAR,
1.37 + members VARCHAR[]
1.38 );
1.39
1.40 CREATE OR REPLACE FUNCTION groups()
1.41 @@ -126,14 +126,14 @@
1.42 DROP TYPE IF EXISTS unix_sql_api_users;
1.43
1.44 CREATE TYPE unix_sql_api_users AS (
1.45 - id INTEGER,
1.46 - gid INTEGER,
1.47 - name VARCHAR,
1.48 - -- comment VARCHAR,
1.49 - gecos VARCHAR[],
1.50 - home VARCHAR,
1.51 - shell VARCHAR
1.52 - -- expire VARCHAR
1.53 + id INTEGER,
1.54 + gid INTEGER,
1.55 + name VARCHAR,
1.56 + -- comment VARCHAR,
1.57 + gecos VARCHAR[],
1.58 + home VARCHAR,
1.59 + shell VARCHAR
1.60 + -- expire VARCHAR
1.61 );
1.62
1.63 CREATE OR REPLACE FUNCTION users()
1.64 @@ -171,25 +171,25 @@
1.65
1.66 CREATE OR REPLACE VIEW users_groups AS
1.67 SELECT
1.68 - u1.id AS uid,
1.69 - u1.gid AS gid,
1.70 - u1.name AS user,
1.71 - g1.name AS group,
1.72 - true AS initial
1.73 - FROM users AS u1
1.74 - JOIN groups AS g1 ON (u1.gid = g1.id)
1.75 + u.id AS uid,
1.76 + u.gid AS gid,
1.77 + u.name AS user,
1.78 + g.name AS group,
1.79 + true AS initial
1.80 + FROM users AS u
1.81 + JOIN groups AS g ON (u.gid = g.id)
1.82 UNION
1.83 SELECT
1.84 - u2.id AS uid,
1.85 - g2.*,
1.86 - false AS initial
1.87 + u.id AS uid,
1.88 + g.*,
1.89 + false AS initial
1.90 FROM
1.91 (SELECT
1.92 - id AS gid,
1.93 - unnest(members) AS user,
1.94 - name AS group
1.95 - FROM groups) AS g2
1.96 - JOIN users AS u2 ON (u2.name = g2.user)
1.97 + id AS gid,
1.98 + unnest(members) AS user,
1.99 + name AS group
1.100 + FROM groups) AS g
1.101 + JOIN users AS u ON (u.name = g.user)
1.102 ;
1.103 COMMENT ON COLUMN users_groups.initial IS 'whether this group is the „initial login group“ of given user (the primary group)';
1.104
1.105 @@ -201,11 +201,11 @@
1.106 DROP TYPE IF EXISTS unix_sql_api_processes;
1.107
1.108 CREATE TYPE unix_sql_api_processes AS (
1.109 - id INTEGER,
1.110 - owner INTEGER,
1.111 - command VARCHAR,
1.112 - arguments VARCHAR[],
1.113 - working_dir VARCHAR
1.114 + id INTEGER,
1.115 + owner INTEGER,
1.116 + command VARCHAR,
1.117 + arguments VARCHAR[],
1.118 + working_dir VARCHAR
1.119 );
1.120
1.121 CREATE OR REPLACE FUNCTION processes()