Overview
Comment: | * reworked indexes * added scripts to dump/load db |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f1bafd194a685dc91e1d6c59d1a06916 |
User & Date: | c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2010-03-18 15:26:27.000 |
Other Links: | branch diff | manifest | tags |
Context
2010-03-18
| ||
15:55 | * instead of fuzzy logic with merging many tags splitted some functionality from mark() which only works now with single tag, for many tags there is a set() function; * added option to drop site table. check-in: 7224844efa user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
15:26 | * reworked indexes * added scripts to dump/load db check-in: f1bafd194a user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
2010-03-01
| ||
14:29 | added logged fail when compiling regexp check-in: d2c54d0451 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
Changes
Modified database.sql
from [0f042d67c0]
to [83b3f67d5d].
︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + + + + + + + + + + + + + + + | $$; create or replace function get_site(domain text) returns integer language sql immutable strict as $$ select get_site(tripdomain($1)) as result; $$; -- this function inserts or updates record with tags to site by site id with regexp CREATE or replace FUNCTION mark(my_id_site integer, my_id_tag integer, my_regexp text) RETURNS integer LANGUAGE plpgsql STRICT AS $$ declare -- maybe check should be added to make sure supplied site id really exists my_tag text[]; begin -- selecting tags site already have and adding new tag to them -- note that tags should be sorted to eliminate permutations select coalesce(tag, '{}'::text[]) from urls natural left join tag where id_site = my_id_site and regexp = my_regexp into my_tag; if not found then -- no records found - creating new tag insert into urls (id_site, id_tag, regexp) values (my_id_site, my_id_tag, my_regexp); else -- joining tags select usort(my_tag || tag) from tag where id_tag = my_id_tag into my_tag; -- updating existing record update urls set id_tag = get_tag(my_tag) where id_site = my_id_site and regexp = my_regexp; end if; return my_id_site; end; $$; -- this function adds tag to site by site id CREATE or replace FUNCTION mark(my_id_site integer, new_tag text) RETURNS integer LANGUAGE plpgsql STRICT AS $$ declare -- maybe check should be added to make sure supplied site id really exists my_tag text[]; |
︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | + + + + | to_time time without time zone DEFAULT '23:59:59'::time without time zone NOT NULL, id_tag smallint NOT NULL ); ALTER TABLE ONLY rules ADD CONSTRAINT rules_pkey PRIMARY KEY (netmask); ALTER TABLE ONLY rules ADD CONSTRAINT rules_tag_f FOREIGN KEY (id_tag) REFERENCES tag(id_tag) MATCH FULL ON UPDATE RESTRICT ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED; -- table to hold site arrays CREATE TABLE site ( id_site serial, site text[] NOT NULL ); ALTER TABLE ONLY site |
︙ | |||
170 171 172 173 174 175 176 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - - + - + + + + - + + + + | CREATE TABLE urls ( date_added timestamp without time zone DEFAULT ('now'::text)::timestamp(0) without time zone NOT NULL, id_site smallint NOT NULL, id_tag smallint NOT NULL, regexp text ); |
︙ |
Added st-dump.py version [cddaeeeb13].
Added st-load.py version [3246bbaf0b].