# HG changeset patch # User HIROSE Yuuji # Date 1455863812 -32399 # Node ID e9f9c72bfa48094cce7822bd02b5af1be92d41c1 # Parent cdade692e17d6b7854d4c2b03ca6b363b5a777a6 create view "gecoses", through which gecos name can be retrieved diff -r cdade692e17d -r e9f9c72bfa48 s4-init.sh --- a/s4-init.sh Thu Feb 11 17:06:19 2016 +0859 +++ b/s4-init.sh Fri Feb 19 15:36:51 2016 +0859 @@ -75,6 +75,18 @@ primary key(user, tbl, rowid), \ foreign key(user) references user(name))" +create view gecoses "AS +SELECT name, + coalesce( + case when (SELECT name FROM user u WHERE u.name=name) IS NOT NULL + then (SELECT val FROM user_s u + WHERE u.name=a.name AND key='gecos') + else (SELECT val FROM grp_s g + WHERE g.gname=name AND key='gecos') + end, + name) gecos +FROM (SELECT name FROM user UNION ALL SELECT gname FROM grp) a;" + for f in $formdir/*def; do echo -n Creating form of $f...