datasets-br / sql-unifier

Try all datasets in a single SQL table, plug-and-play!
3 stars 0 forks source link

Corrigir falhas do make #18

Open ppKrauss opened 6 years ago

ppKrauss commented 6 years ago

Falhas que aparecem durante o sh src/cache/make.sh:

ERRO:  não pode mudar nome de parâmetro de entrada "p_no_null"
DICA:  Primeiro utilize DROP FUNCTION array_distinct(anyarray,boolean).
...
CREATE FUNCTION
ERRO:  parênteses não correspondem em ou próximo a ")"
LINHA 41:           );
                    ^
NOTA:  extensão "file_fdw" já existe, ignorando
CREATE EXTENSION
NOTA:  removendo em cascata outros 15 objetos
DETALHE:  removendo em cascata tabela externa tmpcsv6_autoridade
removendo em cascata tabela externa tmpcsv6_localidade
...
...
ERRO:  erro de sintaxe em ou próximo a "68"
LINHA 1: ...->>2)::text AS assis_brasil,  (j->>3)::numeric AS 68 FROM (S...
                                                              ^
CONSULTA:  CREATE VIEW dataset.vw8_anatel2013_abrevs3letras AS SELECT  (j->>0)::text AS AC,  (j->>1)::text AS ABL,  (j->>2)::text AS assis_brasil,  (j->>3)::numeric AS 68 FROM (SELECT jsonb_array_elements(j) FROM dataset.big WHERE source=16) t(j)
CONTEXTO:  função PL/pgSQL dataset."create"(integer,text,boolean,text,text) linha 18 em EXECUTE
INSERT 0 1
ERRO:  faltando dados da coluna "municipio"
CONTEXTO:  COPY tmpcsv8_anatel_ddd_chave, linha 69: ""
comando SQL "INSERT INTO dataset.big(source,j)  SELECT 17, jsonb_agg(jsonb_build_array(ddd, municipio, uf)) FROM tmpcsv8_anatel_ddd_chave"
função PL/pgSQL dataset."create"(integer,text,boolean,text,text) linha 36 em EXECUTE
INSERT 0 1

O problema surgiu com o seguinte conf:

{
  "db": "postgresql://postgres:postgres@localhost:5432/trydatasets",
  "github.com":{
    "lexml/lexml-vocabulary":null,
    "datasets/language-codes":null,
    "datasets/country-codes":null,
    "datasets/world-cities":{
      "_corrections_":{"resources":[{"primaryKey": "geonameid"}]}
    },
    "datasets-br/state-codes":"br-state-codes",
    "datasets-br/city-codes":null
  },
  "local-csv":{
     "anatel":{
       "separator":",",
       "folder":"/home/user/gits/datasets-br/city-codes/data/dump_etc"
     }
  },
  "useBig":true,  "useIDX":false,        "useRename":true,
  "useYUml":true, "useAllNsAsDft":false
}

Quando modificado o local-csv também deu erro

  "local-csv":{
    "citAux":{"folder":"/home/user/gits/datasets-br/city-codes/data"}
  },
ppKrauss commented 4 years ago

Talvez as mesmas falhas em 2019 com PostgreSQL v12:

sh src/cache/make.sh
...
2019-11-25 15:50:56 (24.4 MB/s) - ‘/tmp/tmpcsv/br_city_codes.csv’ saved [424494/424494]
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE VIEW
CREATE VIEW
ERROR:  schema "lib" does not exist
...
NOTICE:  schema "dataset" does not exist, skipping
DROP SCHEMA
CREATE SCHEMA
CREATE FUNCTION
CREATE FUNCTION
CREATE TABLE
INSERT 0 1
CREATE TABLE
INSERT 0 8
CREATE TABLE
CREATE TABLE
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE TRIGGER
CREATE VIEW
CREATE VIEW
CREATE VIEW
CREATE VIEW
CREATE VIEW
CREATE VIEW
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
ERROR:  set-returning functions are not allowed in CASE
LINE 6:   WHEN jtd='tab-aoa' THEN jsonb_array_elements(j)
                                  ^
HINT:  You might be able to move the set-returning function into a LATERAL FROM item.
ERROR:  function dataset.big_asrows_aoa(integer) does not exist
LINE 2:   SELECT dataset.big_asrows_aoa( dataset.meta_id($1) )
                 ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
ERROR:  function dataset.big_asrows_aoa(integer) does not exist
LINE 8:   (SELECT x FROM dataset.big_asrows_aoa($1) t(x))
                         ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
ERROR:  function dataset.big_asrows_aoa_head(integer) does not exist
LINE 2:   SELECT dataset.big_asrows_aoa_head( dataset.meta_id($1) )
                 ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
CREATE FUNCTION
CREATE FUNCTION
...
CREATE FUNCTION
CREATE FUNCTION
ERROR:  mismatched parentheses at or near ")"
LINE 41:           );
                   ^
CREATE EXTENSION
NOTICE:  server "csv_files" does not exist, skipping
DROP SERVER
CREATE SERVER
INSERT 0 1
                      create
--------------------------------------------------
 ok all created for dataset.vw6_autoridade (id 1)
(1 row)
..... 
                         bye
-----------------------------------------------------
 Use SELECT dataset.validate() to check constraints.