1

While trying to import a table containing raster data in QGIS , Raster column is not being imported ... I am getting following messages:

  1. Database connection was successful , but the accessible tables could not be determined.

  2. The view 'public.raster_columns' has no column suitable for use as a unique key. Quantum GIS requires that the view has a column that can be used as a unique key. Such a column should be derived from a table column of type int4 and be a primary key, have a unique constraint on it, or be a PostgreSQL oid column. To improve performance the column should also be indexed.

Please help.

Table Used:

CREATE TABLE everest
(
  rid serial NOT NULL,
  rast raster,
  filename text,
)

After adding primary key constraint also , I am getting same error message. I use raster2pgsql command to create a sql file corresponding to the raster tif file. And thereafter pgadmin to create table in postgis from the sql file , Here , rid is primary key and of type serial .

1
  • 1
    How are you trying to open the raster layer?
    – Nathan W
    Commented Jun 12, 2012 at 13:35

1 Answer 1

3

Not sure about the first error, but it sounds like you need a primary key column. Looks like that's what you intended 'rid' to be, since it's a serial field, but you still need to explicitly state that it's the PK:

CREATE TABLE everest
(
    rid serial PRIMARY KEY,
    rast raster,
    filename text
)

Note that using PRIMARY KEY implies both UNIQUE and NOT NULL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.