prototyp: user_group → groups + comment
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 01 Sep 2014 16:04:59 +0200
changeset 4b0bbfff8eca1
parent 3 2cd2860c8fb3
child 5 bb406ad320b6
prototyp: user_group → groups + comment
prototyp/prototyp.sql
     1.1 --- a/prototyp/prototyp.sql	Mon Sep 01 15:56:05 2014 +0200
     1.2 +++ b/prototyp/prototyp.sql	Mon Sep 01 16:04:59 2014 +0200
     1.3 @@ -63,18 +63,18 @@
     1.4  
     1.5  -- user groups: --------------------------------------------------------------
     1.6  
     1.7 -DROP VIEW IF EXISTS user_group;
     1.8 -DROP FUNCTION IF EXISTS user_group();
     1.9 -DROP TYPE IF EXISTS unix_sql_api_user_group;
    1.10 +DROP VIEW IF EXISTS groups;
    1.11 +DROP FUNCTION IF EXISTS groups();
    1.12 +DROP TYPE IF EXISTS unix_sql_api_groups;
    1.13  
    1.14 -CREATE TYPE unix_sql_api_user_group AS (
    1.15 +CREATE TYPE unix_sql_api_groups AS (
    1.16  	id INTEGER,
    1.17  	name VARCHAR,
    1.18  	members VARCHAR[]
    1.19  );
    1.20  
    1.21 -CREATE OR REPLACE FUNCTION user_group()
    1.22 -RETURNS SETOF unix_sql_api_user_group AS $$
    1.23 +CREATE OR REPLACE FUNCTION groups()
    1.24 +RETURNS SETOF unix_sql_api_groups AS $$
    1.25  	use strict;
    1.26  	use warnings;
    1.27  	
    1.28 @@ -91,7 +91,8 @@
    1.29  	return undef;
    1.30  $$ LANGUAGE plperlu;
    1.31  
    1.32 -CREATE OR REPLACE VIEW user_group AS
    1.33 -	SELECT * FROM user_group()
    1.34 +CREATE OR REPLACE VIEW groups AS
    1.35 +	SELECT * FROM groups()
    1.36  ;
    1.37 +COMMENT ON COLUMN groups.members IS 'does not contain users for who have this group as primary one';
    1.38