Mercurial > dive4elements > river
comparison backend/doc/schema/postgresql.sql @ 8658:3531f0cee5e1
Whitespace-cleanup schema files.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Thu, 02 Apr 2015 17:17:51 +0200 |
parents | b8c6cb36607e |
children | cfafe5764509 |
comparison
equal
deleted
inserted
replaced
8657:4054c7fce43e | 8658:3531f0cee5e1 |
---|---|
255 | 255 |
256 UNIQUE (wst_column_id, named_main_value_id) | 256 UNIQUE (wst_column_id, named_main_value_id) |
257 ); | 257 ); |
258 | 258 |
259 CREATE VIEW wst_value_table AS | 259 CREATE VIEW wst_value_table AS |
260 SELECT | 260 SELECT |
261 wcv.position AS position, | 261 wcv.position AS position, |
262 w, | 262 w, |
263 q, | 263 q, |
264 wc.position AS column_pos, | 264 wc.position AS column_pos, |
265 w.id AS wst_id | 265 w.id AS wst_id |
266 FROM wsts w | 266 FROM wsts w |
267 JOIN wst_columns wc | 267 JOIN wst_columns wc |
277 ORDER BY wcv.position ASC, | 277 ORDER BY wcv.position ASC, |
278 wc.position DESC; | 278 wc.position DESC; |
279 | 279 |
280 -- view to select the w values of a WST | 280 -- view to select the w values of a WST |
281 CREATE VIEW wst_w_values AS | 281 CREATE VIEW wst_w_values AS |
282 SELECT wcv."position" AS km, | 282 SELECT wcv."position" AS km, |
283 wcv.w AS w, | 283 wcv.w AS w, |
284 wc."position" AS column_pos, | 284 wc."position" AS column_pos, |
285 w.id AS wst_id | 285 w.id AS wst_id |
286 FROM wst_column_values wcv | 286 FROM wst_column_values wcv |
287 JOIN wst_columns wc ON wcv.wst_column_id = wc.id | 287 JOIN wst_columns wc ON wcv.wst_column_id = wc.id |
288 JOIN wsts w ON wc.wst_id = w.id | 288 JOIN wsts w ON wc.wst_id = w.id |
289 ORDER BY wcv."position", wc."position"; | 289 ORDER BY wcv."position", wc."position"; |
290 | 290 |
291 -- view to select the q values of a WST | 291 -- view to select the q values of a WST |
292 CREATE VIEW wst_q_values AS | 292 CREATE VIEW wst_q_values AS |
293 SELECT wc.position AS column_pos, | 293 SELECT wc.position AS column_pos, |
294 wqr.q AS q, | 294 wqr.q AS q, |
295 r.a AS a, | 295 r.a AS a, |
296 r.b AS b, | 296 r.b AS b, |
297 wc.wst_id AS wst_id | 297 wc.wst_id AS wst_id |
298 FROM wst_column_q_ranges wcqr | 298 FROM wst_column_q_ranges wcqr |
299 JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id | 299 JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id |
300 JOIN ranges r ON wqr.range_id = r.id | 300 JOIN ranges r ON wqr.range_id = r.id |