Mercurial > gemma
annotate schema/updates/1106/01.schemaqualify_tables.sql @ 5437:eeee1c411576 marking-single-beam
Pdf-Template: Use survey-date for {date-minor} when bottleneck survey is visible.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 13 Jul 2021 12:24:29 +0200 |
parents | d3fb2f37380b |
children |
rev | line source |
---|---|
4173
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 CREATE OR REPLACE FUNCTION get_schema_version() RETURNS int |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 LANGUAGE sql |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 AS $$ |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 SELECT max(version) FROM public.gemma_schema_version; |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 $$; |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 CREATE OR REPLACE FUNCTION is_country(code char) RETURNS boolean |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 AS $$ |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 SELECT EXISTS(SELECT 1 FROM public.countries WHERE country_code = code) |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 $$ |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 LANGUAGE sql |
d3fb2f37380b
Schema qualify tables in function body
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 STABLE PARALLEL SAFE; |