appbaseio / appbaseio/abc

Error importing Postgres table with empty array column

Abierto
#189 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
471
Forks
47
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I am hitting the below error when trying to import data from a Postgres table, with a column of type "array" and empty value.

E.g. consider a PG table like this:

```
postgres@[local]/postgres
15:16:56 =# \d lbolla
Table "public.lbolla"
Column | Type | Collation | Nullable | Default
--------+--------+-----------+----------+---------
data | text[] | | |

```

with this values:

```
postgres@[local]/postgres
15:16:57 =# select * from lbolla;
data
-----------
{foo,bar}
{}
(2 rows)
```

I now try to import it:

```
abc import --src_type=postgres --src_uri="postgresql://postgres@localhost/postgres" --src_filter="lbolla" "http://localhost:9200/abc_test"

panic: runtime error: index out of range

goroutine 67 [running]:
github.com/appbaseio/abc/private/adaptor/postgres.casifyValue(0xc00047a5a2, 0x2, 0xc00047a4e0, 0x6, 0xc00047a5a2, 0x2)
/go/src/github.com/appbaseio/abc/private/adaptor/postgres/tailer.go:267 +0xdef
github.com/appbaseio/abc/private/adaptor/postgres.(*Reader).iterateTable.func1(0xc00046e480, 0xc00046e420, 0xc000131220, 0x8, 0xc000116180, 0xc0000a8b40)
/go/src/github.com/appbaseio/abc/private/adaptor/postgres/reader.go:170 +0xced
created by github.com/appbaseio/abc/private/adaptor/postgres.(*Reader).iterateTable
/go/src/github.com/appbaseio/abc/private/adaptor/postgres/reader.go:104 +0x91
```

The error is caused by the row with empty ('{}') value.

I am using:

```
abc versionVersion: 1.0.0-beta.1
Variant: !oss
Go version: go1.12.5
OS: linux
Arch: amd64
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.