X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/77eb26995a1185e50b2b275f058264857bed9cc7..1aa2a631dbc085fcdf72c9e6cef0a0de9a67f0a4:/tools/word.pg.sql?ds=sidebyside diff --git a/tools/word.pg.sql b/tools/word.pg.sql index 6cab79d..da22b55 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -19,3 +19,9 @@ COMMENT ON COLUMN word.prio IS 'difficulty level or importance; lower valu COMMENT ON COLUMN word.source IS 'URI of downloaded image'; COMMENT ON COLUMN word.thumb IS 'ImageMagick convert options to create thumbnail from source image'; COMMENT ON COLUMN word.wptitle IS 'reference Wikipedia article'; + +CREATE OR REPLACE VIEW _cat_words AS + SELECT * FROM word RIGHT JOIN ( + SELECT cat id, array_agg(form ORDER BY form) forms + FROM word WHERE ref IS NULL GROUP BY cat + ) sub USING (id);