Bom dia,
Estou a usar o colibri12 versão livre, sistema operativo linux (Ubuntu), e o motor postgresql para a base de dados. Fiz o backup da bd no pgadmin3, atualizei o so (ubuntu 17.10) e não consigo restaurar a bd.
O erro é semelhante ao já reportado aqui (
www.projectocolibri.com/forum/bases-de-d...-de-dados-postgresql), mas não consigo resolvê-lo.
Os testes realizados foram feitos com a versão 9.6 dos postgresql (a que está nos repositórios oficiais do ubuntu) e com o 9.5.7 (a que estava instalada aquando do backup)
Quando fiz o backup, "penso" que escolhi o formato "custom" (sim, deveria ter estado mais atento). As primeiras linhas do backup são:
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.7
-- Dumped by pg_dump version 9.5.7
-- Started on 2018-03-30 00:07:16 WEST
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
SET search_path = public, pg_catalog;
--
-- TOC entry 2785 (class 0 OID 861121)
-- Dependencies: 181
-- Data for Name: ARMAZENS; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY "ARMAZENS" ("CODIGO", "CODIGOPOSTAL", "CONTACTO", "DESCRICAO", "EMAIL", "FAX", "MORADA", "TELEFONE", "TELEFONE2", "RECORD_CONTROL") FROM stdin;
001 1000-000 N/Armazém MORADA DO ARMAZEM 1
\.
--
-- TOC entry 2786 (class 0 OID 861127)
-- Dependencies: 182
-- Data for Name: ARTIGOS; Type: TABLE DATA; Schema: public; Owner: postgres--
De seguida transcrevo as 3 formas que usei para tentar restaurar a bd.
Agradecia ajuda na resolução do problema. Se julgarem necessário posso enviar-vos a bd. Se não conseguir resolver o problema, o vosso apoio técnico pode fazer este serviço? Podem enviar-me um orçamento, sff?
Agradeço a atenção.
Cumprimentos,
António Rodrigues
-Tentativas para restaurar a bd que executei:
1) No pgadmin3
/usr/bin/pg_restore --host localhost --port 5432 --username "postgres" --dbname "colibri12" --role "postgres" --no-password --list "/home/antonio/Desktop/colibri12.backup"
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
Process returned exit code 1.
An error has occurred:
11:17:40: Error: File '' couldn't be removed (error 2: No such file or directory)
^
2) Para uma bd previamente criada no postgresql e no colibri, com toda a estrutura (tabelas, etc)
antonio@antonio-N552VX:~/Desktop$ sudo -u postgres psql colibri12 < "colibri12.backup"
SET
SET
SET
SET
SET
SET
SET
SET
ERROR: duplicate key value violates unique constraint "ARMAZENS_pkey"
DETAIL: Key ("CODIGO")=(001) already exists.
CONTEXT: COPY ARMAZENS, line 1
ERROR: insert or update on table "ARTIGOS" violates foreign key constraint "ARTIGOS_FK7"
DETAIL: Key (GRUPO)=(2) is not present in table "GRUPOS".
COPY 0
COPY 0
COPY 0
ERROR: insert or update on table "ARTIGOSEXISTENCIAS" violates foreign key constraint "ARTIGOSEXISTENCIAS_FK4"
DETAIL: Key (ARTIGO)=(6) is not present in table "ARTIGOS".
ERROR: insert or update on table "ARTIGOSMOVIMENTOS" violates foreign key constraint "ARTIGOSMOVIMENTOS_FK4B"
3) Para uma bd vazia
antonio@antonio-N552VX:~/Desktop$ sudo -u postgres psql teste < "colibri12.backup"
SET
SET
SET
SET
SET
SET
SET
SET
ERROR: relation "ARMAZENS" does not exist
invalid command \.
ERROR: syntax error at or near "001"
LINE 1: 001 1000-000 N/Armazém MORADA DO ARMAZEM 1
^
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \.
ERROR: syntax error at or near "9"
LINE 1: 9 admin 1 2 23 0.000000 2017-09-16 2017-09-16 Letr...
^
invalid command \.
ERROR: relation "ARTIGOSDOCUMENTOS" does not exist
invalid command \.
ERROR: relation "ARTIGOSDOCUMENTOSLINHAS" does not exist
invalid command \.
ERROR: relation "ARTIGOSEXISTENCIAS" does not exist
invalid command \.
ERROR: syntax error at or near "6"
LINE 1: 6:001:0:01:01 001 6 01 0.000000 0 20.000000 -20.000000 01 2