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 .

underdark
84.9k22 gold badges237 silver badges418 bronze badges
asked Jun 12, 2012 at 13:11
1
  • 1
    How are you trying to open the raster layer? 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.

answered Jun 12, 2012 at 19:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.