Revision 7810
Added by Aaron Marcuse-Kubitza almost 12 years ago
schemas/vegbien.sql | ||
---|---|---|
478 | 478 |
CREATE FUNCTION _locationnarrative_is_cultivated(locationnarrative text) RETURNS boolean |
479 | 479 |
LANGUAGE sql IMMUTABLE STRICT |
480 | 480 |
AS $_$ |
481 |
SELECT |
|
482 |
$1 LIKE '%cultivated%' |
|
483 |
OR $1 LIKE '%cultivad%' |
|
484 |
OR $1 LIKE '%ornamental%' |
|
485 |
OR $1 LIKE '%garden%' |
|
486 |
OR $1 LIKE '%jardin%' |
|
487 |
OR $1 LIKE '%jard?n%' |
|
488 |
OR $1 LIKE '%jardim%' |
|
489 |
OR $1 LIKE '%plantation%' |
|
490 |
OR $1 LIKE '%plantacion%' |
|
491 |
OR $1 LIKE '%plantaci?n%' |
|
492 |
OR $1 LIKE '%universit%' |
|
493 |
OR $1 LIKE '%universidad%' |
|
494 |
OR $1 LIKE '%campus%' |
|
495 |
OR $1 LIKE '%urban%' |
|
496 |
OR $1 LIKE '%greenhouse%' |
|
497 |
OR $1 LIKE '%arboretum%' |
|
498 |
OR $1 LIKE '%farm%' |
|
499 |
OR $1 LIKE '%weed%' |
|
500 |
OR $1 LIKE '%corn field%' |
|
481 |
SELECT bool_or(value) |
|
482 |
FROM |
|
483 |
(VALUES |
|
484 |
(NULLIF($1 LIKE '%cultivated%', false)) |
|
485 |
, (NULLIF($1 LIKE '%cultivad%', false)) |
|
486 |
, (NULLIF($1 LIKE '%ornamental%', false)) |
|
487 |
, (NULLIF($1 LIKE '%garden%', false)) |
|
488 |
, (NULLIF($1 LIKE '%jardin%', false)) |
|
489 |
, (NULLIF($1 LIKE '%jard?n%', false)) |
|
490 |
, (NULLIF($1 LIKE '%jardim%', false)) |
|
491 |
, (NULLIF($1 LIKE '%plantation%', false)) |
|
492 |
, (NULLIF($1 LIKE '%plantacion%', false)) |
|
493 |
, (NULLIF($1 LIKE '%plantaci?n%', false)) |
|
494 |
, (NULLIF($1 LIKE '%universit%', false)) |
|
495 |
, (NULLIF($1 LIKE '%universidad%', false)) |
|
496 |
, (NULLIF($1 LIKE '%campus%' , false)) |
|
497 |
, (NULLIF($1 LIKE '%urban%', false)) |
|
498 |
, (NULLIF($1 LIKE '%greenhouse%', false)) |
|
499 |
, (NULLIF($1 LIKE '%arboretum%', false)) |
|
500 |
, (NULLIF($1 LIKE '%farm%', false)) |
|
501 |
, (NULLIF($1 LIKE '%weed%', false)) |
|
502 |
, (NULLIF($1 LIKE '%corn field%', false)) |
|
503 |
) |
|
504 |
AS v (value) |
|
501 | 505 |
$_$; |
502 | 506 |
|
503 | 507 |
|
Also available in: Unified diff
schemas/vegbien.sql: _locationnarrative_is_cultivated(): Fixed bug where need to use NULL instead of false (and bool_or() instead of OR) for a non-match, because the absence of a match doesn't mean it's not cultivated