From: Mischa POSLAWSKY Date: Mon, 15 Jun 2020 22:34:40 +0000 (+0200) Subject: word: identify rows by id number X-Git-Tag: v1.13~207 X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/e1678ab9198c2709c7363af618fa5c7bd26930f5 word: identify rows by id number With the addition of more entries, names are no longer unique: for example pink (colour and flower) in multiple categories. --- diff --git a/tools/mkwordlist b/tools/mkwordlist index b88cd1b..e1729a3 100755 --- a/tools/mkwordlist +++ b/tools/mkwordlist @@ -1,5 +1,5 @@ #!/bin/sh echo 'use utf8;' psql sheet -XAt -c " - SELECT json_object_agg(coalesce(form, ''), forms) FROM _cat_words + SELECT json_object_agg(coalesce(id::text, ''), forms) FROM _cat_words " | sed 's/ : / => /g' diff --git a/tools/word.pg.sql b/tools/word.pg.sql index 3a0f158..3c05c38 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -42,7 +42,8 @@ COMMENT ON COLUMN word.creator IS 'user responsible for initial submit'; CREATE OR REPLACE FUNCTION exportform(word) RETURNS text AS $$ SELECT concat( - $1.prio || CASE WHEN $1.cover THEN 'c' ELSE '' END || ':', + $1.id, ':', + $1.prio, CASE WHEN $1.cover THEN 'c' ELSE '' END, ':', array_to_string($1.form || $1.alt, '/') ); $$ LANGUAGE SQL IMMUTABLE; diff --git a/word.plp b/word.plp index 1af9c75..78e46a5 100644 --- a/word.plp +++ b/word.plp @@ -55,19 +55,19 @@ sub showimg { sub printimgs { say ''; } say '';