Overview
Comment: | * added array sorting functions; * indexes modified to check array uniqueness. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e0ecab03f941edc5d150ab97b4b6bfde |
User & Date: | c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2009-10-07 14:20:59.000 |
Other Links: | branch diff | manifest | tags |
Context
2009-10-08
| ||
21:51 | reworked mark functions, now they can update data without deleting it check-in: 2326f3bb9a user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
2009-10-07
| ||
14:20 | * added array sorting functions; * indexes modified to check array uniqueness. check-in: e0ecab03f9 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
12:54 | * fixed log enabling; * added missed index; * domain is not stored anymore. check-in: 4b22e25f24 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
Changes
Modified database.sql
from [99d7edbc00]
to [c71bdf1f8e].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | + + + + + + + + + + + + + + + | CREATE PROCEDURAL LANGUAGE plpgsql; -- general array sorting functions -- sorts array CREATE FUNCTION sort(original anyarray) RETURNS anyarray LANGUAGE sql IMMUTABLE STRICT AS $_$ select array_agg(item) as result from (select unnest($1) as item order by item) a; $_$; -- sorts array and removes duplicates CREATE FUNCTION usort(original anyarray) RETURNS anyarray LANGUAGE sql IMMUTABLE STRICT AS $_$ select array_agg(item) as result from (select distinct unnest($1) as item order by item) a; $_$; -- this function adds tag to domain CREATE FUNCTION mark(domain text, new_tag text) RETURNS void LANGUAGE plpgsql STRICT AS $$ declare my_site text[]; |
︙ | |||
23 24 25 26 27 28 29 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - - + - - + + - - + - - + + | -- note that tags should be sorted to eliminate permutations select tag from urls natural join tag where id_site = my_site_id into my_tag; if not found then -- no records found - creating new tag my_tag := array[new_tag]; else -- joining tags |
︙ | |||
140 141 142 143 144 145 146 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - + - + - + - + | id_site serial, site text[] NOT NULL ); ALTER TABLE ONLY site ADD CONSTRAINT site_id PRIMARY KEY (id_site); |
︙ |