diff options
Diffstat (limited to 'sql/modules/Entity.sql')
-rw-r--r-- | sql/modules/Entity.sql | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/modules/Entity.sql b/sql/modules/Entity.sql index ba98c62a..9c742e4b 100644 --- a/sql/modules/Entity.sql +++ b/sql/modules/Entity.sql @@ -37,4 +37,24 @@ CREATE OR REPLACE FUNCTION entity_save( $$ language 'plpgsql'; + +CREATE OR REPLACE FUNCTION entity__get_entity ( + in_entity_id int +) RETURNS setof entity AS $$ + +declare + v_row entity; +BEGIN + SELECT * INTO v_row FROM entity WHERE id = in_entity_id; + IF NOT FOUND THEN + raise exception "Could not find entity with ID %", in_entity_id; + ELSE + return next v_row; + END IF; +END; + +$$ language plpgsql; + + + commit; |