diff -r c6688467d03c -r 552252ca87db prototyp/prototyp.sql --- a/prototyp/prototyp.sql Tue Sep 02 00:06:04 2014 +0200 +++ b/prototyp/prototyp.sql Tue Sep 02 10:25:23 2014 +0200 @@ -28,15 +28,15 @@ DROP TYPE IF EXISTS unix_sql_api_fstab; CREATE TYPE unix_sql_api_fstab AS ( - device VARCHAR, - device_type VARCHAR, - device_value VARCHAR, - mount_point VARCHAR, - type VARCHAR, - types VARCHAR[], - options VARCHAR[], - dump INTEGER, - pass INTEGER + device VARCHAR, + device_type VARCHAR, + device_value VARCHAR, + mount_point VARCHAR, + type VARCHAR, + types VARCHAR[], + options VARCHAR[], + dump INTEGER, + pass INTEGER ); CREATE OR REPLACE FUNCTION fstab() @@ -88,9 +88,9 @@ DROP TYPE IF EXISTS unix_sql_api_groups; CREATE TYPE unix_sql_api_groups AS ( - id INTEGER, - name VARCHAR, - members VARCHAR[] + id INTEGER, + name VARCHAR, + members VARCHAR[] ); CREATE OR REPLACE FUNCTION groups() @@ -126,14 +126,14 @@ DROP TYPE IF EXISTS unix_sql_api_users; CREATE TYPE unix_sql_api_users AS ( - id INTEGER, - gid INTEGER, - name VARCHAR, - -- comment VARCHAR, - gecos VARCHAR[], - home VARCHAR, - shell VARCHAR - -- expire VARCHAR + id INTEGER, + gid INTEGER, + name VARCHAR, + -- comment VARCHAR, + gecos VARCHAR[], + home VARCHAR, + shell VARCHAR + -- expire VARCHAR ); CREATE OR REPLACE FUNCTION users() @@ -171,25 +171,25 @@ CREATE OR REPLACE VIEW users_groups AS SELECT - u1.id AS uid, - u1.gid AS gid, - u1.name AS user, - g1.name AS group, - true AS initial - FROM users AS u1 - JOIN groups AS g1 ON (u1.gid = g1.id) + u.id AS uid, + u.gid AS gid, + u.name AS user, + g.name AS group, + true AS initial + FROM users AS u + JOIN groups AS g ON (u.gid = g.id) UNION SELECT - u2.id AS uid, - g2.*, - false AS initial + u.id AS uid, + g.*, + false AS initial FROM (SELECT - id AS gid, - unnest(members) AS user, - name AS group - FROM groups) AS g2 - JOIN users AS u2 ON (u2.name = g2.user) + id AS gid, + unnest(members) AS user, + name AS group + FROM groups) AS g + JOIN users AS u ON (u.name = g.user) ; COMMENT ON COLUMN users_groups.initial IS 'whether this group is the „initial login group“ of given user (the primary group)'; @@ -201,11 +201,11 @@ DROP TYPE IF EXISTS unix_sql_api_processes; CREATE TYPE unix_sql_api_processes AS ( - id INTEGER, - owner INTEGER, - command VARCHAR, - arguments VARCHAR[], - working_dir VARCHAR + id INTEGER, + owner INTEGER, + command VARCHAR, + arguments VARCHAR[], + working_dir VARCHAR ); CREATE OR REPLACE FUNCTION processes()