
diff -r 9963cf89ffd7 -r 88bf2cb5e757 prototyp/prototyp.sql
--- a/prototyp/prototyp.sql	Mon Sep 01 21:08:55 2014 +0200
+++ b/prototyp/prototyp.sql	Mon Sep 01 21:38:26 2014 +0200
@@ -100,8 +100,6 @@
 
 	use User::grent;
 	
-	my $i = 0;
-
 	setgrent();
 	while (my $group = getgrent()) {
 		return_next({
@@ -146,8 +144,6 @@
 	use encoding "UTF-8";
 	use User::pwent;
 	
-	my $i = 0;
-	
 	setpwent();
 	while (my $user = getpwent()) {
 		return_next({
@@ -197,3 +193,42 @@
 ;
 COMMENT ON COLUMN users_groups.initial IS 'whether this group is the „initial login group“ of given user (the primary group)';
 
+
+-- processes: ----------------------------------------------------------------
+
+DROP VIEW IF EXISTS processes;
+DROP FUNCTION IF EXISTS processes();
+DROP TYPE IF EXISTS unix_sql_api_processes;
+
+CREATE TYPE unix_sql_api_processes AS (
+	id INTEGER,
+	uid INTEGER,
+	owner VARCHAR,
+	command VARCHAR,
+	arguments VARCHAR[],
+	working_dir VARCHAR
+);
+
+CREATE OR REPLACE FUNCTION processes()
+RETURNS SETOF unix_sql_api_processes STABLE AS $$
+	use strict;
+	use warnings;
+	
+	use encoding "UTF-8";
+	
+		return_next({
+			id => 123,
+			uid => 456,
+			owner => "nikdo",
+			command => "/bin/omg",
+			arguments => ["a", "b"],
+			working_dir => "/tmp"
+		});
+	
+	return undef;
+$$ LANGUAGE plperlu;
+
+CREATE OR REPLACE VIEW processes AS
+	SELECT * FROM processes()
+;
+




