git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
source: keep original file encoding
[sheet.git]
/
tools
/
word.pg.sql
diff --git
a/tools/word.pg.sql
b/tools/word.pg.sql
index d18a99cb4b3172f464f5302832957e910ba9a678..3c05c3865b6405ca4d00330d826053b67a65df18 100644
(file)
--- a/
tools/word.pg.sql
+++ b/
tools/word.pg.sql
@@
-13,7
+13,8
@@
CREATE TABLE word (
lang text NOT NULL DEFAULT 'en',
cat integer REFERENCES word (id),
ref integer REFERENCES word (id),
lang text NOT NULL DEFAULT 'en',
cat integer REFERENCES word (id),
ref integer REFERENCES word (id),
- prio smallint NOT NULL DEFAULT '1',
+ prio smallint DEFAULT '1'
+ CHECK (prio >= 0 OR ref IS NOT NULL),
grade integer,
cover boolean NOT NULL DEFAULT FALSE,
source text,
grade integer,
cover boolean NOT NULL DEFAULT FALSE,
source text,
@@
-41,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(
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;
array_to_string($1.form || $1.alt, '/')
);
$$ LANGUAGE SQL IMMUTABLE;