gltn / stdm

STDM is a free and open source pro-poor land recordation system based on QGIS, PostgreSQL and PostGIS.
http://stdm.gltn.net/
GNU General Public License v2.0
30 stars 30 forks source link

In a new database the configuration fails because column exists #287

Open wondie opened 6 years ago

wondie commented 6 years ago

In a new database the configuration fails because column exists.

Preparing configuration, please wait...
Configuration update started...
Scanning for changes in Customary_Ownership profile...
Removing redundant foreign key constraints...
Creating check_social_tenure_relationship_document_type entity...
(ProgrammingError) column "code" of relation "cu_check_social_tenure_relationship_document_type" already exists
 '\nALTER TABLE cu_check_social_tenure_relationship_document_type ADD code VARCHAR(5)' {}
Failed to update configuration. Check error logs.

This is how to database looks like after the configuration fails. image And this is the SQL create query for the table cu_check_social_tenure_relationship_document_type

-- Table: public.cu_check_social_tenure_relationship_document_type

-- DROP TABLE public.cu_check_social_tenure_relationship_document_type;

CREATE TABLE public.cu_check_social_tenure_relationship_document_type
(
    id integer NOT NULL DEFAULT nextval('cu_check_social_tenure_relationship_document_type_id_seq'::regclass),
    CONSTRAINT cu_check_social_tenure_relationship_document_type_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.cu_check_social_tenure_relationship_document_type
    OWNER to postgres;
gkahiu commented 6 years ago

This is very strange, could you send me the configuration. Did you have a database with a similar name and deleted it? How many databases are you running in your PostgreSQL instance? I have seen this error before and it was caused my some form of 'cache' by PostgreSQL, the solution was to delete the database and restart the PostgreSQL service.

Anyway, send me the configuration file.

wondie commented 6 years ago

The database is completely new. Meaning the name is not used before. The configuration is sent to you yesterday. It is the Uganda profile. There are 11 databases. Yes, when I created a new database with different name, it works.