summaryrefslogtreecommitdiff
path: root/sql/functions/general.get_gallery.sql
blob: c0972f480325a3c732141171eff4267d8bdb014b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
drop function general.get_gallery (
    p_id bigint
);

create or replace function general.get_gallery (
    p_id bigint
)
returns setof general.gallery_t
as $$
begin
    return query
    select g.id,
        g.description,
        g.filename,
        g.mime_type,
        g.video_embed_url,
        case
          when g.content is null then null
          else substring(g.content::text from 3)
        end as content,
        g.created,
        g.modified
    from general.gallery g
    where g.id = p_id;

    return;
end;
$$ language plpgsql;