);
CREATE TABLE word (
- form text NOT NULL,
+ form text,
alt text[],
- lang text NOT NULL DEFAULT 'en',
+ lang text DEFAULT 'en',
cat integer REFERENCES word (id),
ref integer REFERENCES word (id),
prio smallint DEFAULT '1'
CREATE OR REPLACE FUNCTION exportform(word) RETURNS text AS $$
SELECT concat(
- $1.id, ':',
+ coalesce($1.ref, $1.id), ':',
$1.prio, CASE WHEN $1.cover THEN 'c' ELSE '' END, ':',
array_to_string($1.form || $1.alt, '/')
);