X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/c64bae6314f71d7c4aa3a0c27c53f54f9f7f6344..ac35af3aef24ba0b644f85b0fe98492e9065af1d:/tools/word.pg.sql diff --git a/tools/word.pg.sql b/tools/word.pg.sql index 69ae03c..6647370 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -74,7 +74,8 @@ CREATE OR REPLACE VIEW _word_ref AS coalesce(r.wptitle, w.wptitle) wptitle, coalesce(r.story, w.story ) story, r.creator, r.created, r.updated, - CASE WHEN r.image IS NULL THEN w.id ELSE r.id END id -- image id + CASE WHEN nullif(r.image, '{}') IS NOT NULL THEN r.id + WHEN nullif(w.image, '{}') IS NOT NULL THEN w.id END id -- image id FROM word r LEFT JOIN word w ON w.id = r.ref;