changeset 598:4854a1e85870

Ensure published service is based on existing table Using the OID of the table (via the regclass type) establishes a reference to the system catalogs, which will also allow to distinguish between tables in different schemas if such tables have to be published via different datastores in GeoServer.
author Tom Gottfried <tom@intevation.de>
date Fri, 07 Sep 2018 17:27:01 +0200
parents 3704ce844530
children ac325d191009
files pkg/models/intservices.go schema/gemma.sql
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/models/intservices.go	Fri Sep 07 14:44:38 2018 +0200
+++ b/pkg/models/intservices.go	Fri Sep 07 17:27:01 2018 +0200
@@ -22,8 +22,8 @@
 	mu      sync.Mutex
 }
 
-const selectPublishedServices = `SELECT name, style, as_wms, as_wfs
-FROM sys_admin.published_services ORDER by name`
+const selectPublishedServices = `SELECT relname, style, as_wms, as_wfs
+FROM sys_admin.published_services JOIN pg_class ON name = oid ORDER by relname`
 
 var InternalServices = &IntServices{}
 
--- a/schema/gemma.sql	Fri Sep 07 14:44:38 2018 +0200
+++ b/schema/gemma.sql	Fri Sep 07 17:27:01 2018 +0200
@@ -55,16 +55,13 @@
     )
 
     CREATE TABLE published_services (
-        name varchar PRIMARY KEY,
+        name regclass PRIMARY KEY,
         style bytea,
         as_wms boolean NOT NULL DEFAULT TRUE,
         as_wfs boolean NOT NULL DEFAULT TRUE
     )
 ;
 
--- Tables with geo data to be published with GeoServer.
-INSERT INTO sys_admin.published_services (name) VALUES ('fairway_dimensions');
-
 --
 -- Look-up tables with data that are static in a running system
 --
@@ -443,4 +440,7 @@
     )
 ;
 
+-- Tables with geo data to be published with GeoServer.
+INSERT INTO sys_admin.published_services (name) VALUES ('waterway.fairway_dimensions');
+
 COMMIT;