[Geoserver-users] No primary key or unique index found for

I’m getting the following error “23:38:06,673 WARN [org.geotools.jdbc] (MSC service thread 1-2) No primary key or unique index found for tcwradiuscf”. The error is occurring on a view. We’re using version 2.2.4.

Any help would be greatly appreciated.

Mike

I ran into this error previously when using Oracle as the backend database for my layer. As the error suggested, I created a unique index on the view, republished the layer, and it worked. What database are you using?

In Oracle you can create constraints on views:

Sample from documentation

CREATE VIEW emp_sal (emp_id, last_name,

email UNIQUE,

CONSTRAINT id_pk PRIMARY KEY (emp_id))

AS SELECT employee_id, last_name, email FROM employees;

Donovan

···

From: Michael Sacauskis [mailto:msacauskis@anonymised.com]
Sent: Thursday, October 10, 2013 10:25 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] No primary key or unique index found for

I’m getting the following error “23:38:06,673 WARN [org.geotools.jdbc] (MSC service thread 1-2) No primary key or unique index found for tcwradiuscf”. The error is occurring on a view. We’re using version 2.2.4.

Any help would be greatly appreciated.

Mike

I’m using postgress, I did find a solution, the following insert should be done for each table that the view was created from:

INSERT INTO gt_pk_metadata (table_schema, table_name, pk_column, pk_policy) VALUES ('’, ‘

’, ‘’, ‘assigned’);

Thanks

Mike

From: Corliss, Donovan [mailto:Donovan.Corliss@anonymised.com]
Sent: Thursday, October 10, 2013 12:09 PM
To: geoserver-users@anonymised.comrceforge.net
Subject: Re: [Geoserver-users] No primary key or unique index found for

I ran into this error previously when using Oracle as the backend database for my layer. As the error suggested, I created a unique index on the view, republished the layer, and it worked. What database are you using?

In Oracle you can create constraints on views:

Sample from documentation

CREATE VIEW emp_sal (emp_id, last_name,

email UNIQUE,

CONSTRAINT id_pk PRIMARY KEY (emp_id))

AS SELECT employee_id, last_name, email FROM employees;

Donovan

From: Michael Sacauskis [mailto:msacauskis@anonymised.com]
Sent: Thursday, October 10, 2013 10:25 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] No primary key or unique index found for

I’m getting the following error “23:38:06,673 WARN [org.geotools.jdbc] (MSC service thread 1-2) No primary key or unique index found for tcwradiuscf”. The error is occurring on a view. We’re using version 2.2.4.

Any help would be greatly appreciated.

Mike

On Thu, Oct 10, 2013 at 7:25 PM, Michael Sacauskis <
msacauskis@anonymised.com> wrote:

I’m getting the following error “23:38:06,673 WARN [org.geotools.jdbc]
(MSC service thread 1-2) No primary key or unique index found for
tcwradiuscf”. The error is occurring on a view. We’re using version 2.2.4.

First a simple observation: WARN != ERROR
Warning are not fatal, and are not errors.

Anyways, it complains because without a primary key some aspects of the WFS
won't be compliant, in paritcular,
it's not possible to generate stable feature ids, as a result, a client
doing a featureid filter won't get back any of
the features at all (GetFeature with &featureid=id1,id2,...)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------