Mercurial > gemma
comparison schema/gemma.sql @ 4605:7650d2431f86 geoserver_sql_views
Separate schema and table name
Since a GeoServer data source is bound to a specific database schema,
names have to be given without schema qualification. Since we cannot
use regclass for names of SQL views, the name is now a varchar. This
way it's more straightforward to store schema and name separately.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 05 Sep 2019 11:33:01 +0200 |
parents | d24e951206ca |
children | b5aa1eb83bb0 |
comparison
equal
deleted
inserted
replaced
4604:ca8d18f794f3 | 4605:7650d2431f86 |
---|---|
290 remote_url varchar NOT NULL, | 290 remote_url varchar NOT NULL, |
291 is_wfs boolean NOT NULL DEFAULT TRUE | 291 is_wfs boolean NOT NULL DEFAULT TRUE |
292 ) | 292 ) |
293 | 293 |
294 CREATE TABLE published_services ( | 294 CREATE TABLE published_services ( |
295 name varchar PRIMARY KEY, | 295 schema varchar CHECK(to_regnamespace(schema) IS NOT NULL), |
296 name varchar, | |
297 PRIMARY KEY (schema, name), | |
296 -- SQL statement used for an SQL view in GeoServer: | 298 -- SQL statement used for an SQL view in GeoServer: |
297 view_def text CHECK (is_valid_from_item(view_def)), | 299 view_def text CHECK (is_valid_from_item(view_def)), |
298 style xml CHECK(style IS DOCUMENT), | 300 style xml CHECK(style IS DOCUMENT), |
299 as_wms boolean NOT NULL DEFAULT TRUE, | 301 as_wms boolean NOT NULL DEFAULT TRUE, |
300 as_wfs boolean NOT NULL DEFAULT TRUE, | 302 as_wfs boolean NOT NULL DEFAULT TRUE, |
301 -- Either give a valid relation name or a SQL statement: | 303 -- Either give a valid relation or a SQL statement: |
302 CHECK (to_regclass(name) IS NOT NULL OR view_def IS NOT NULL) | 304 CHECK (to_regclass(schema || '.' || name) IS NOT NULL |
305 OR view_def IS NOT NULL) | |
303 ) | 306 ) |
304 ; | 307 ; |
305 | 308 |
306 -- | 309 -- |
307 -- Look-up tables with data that are static in a running system | 310 -- Look-up tables with data that are static in a running system |