Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing Postgres table with empty array column #189

Open
lbolla opened this issue Sep 9, 2020 · 0 comments
Open

Error importing Postgres table with empty array column #189

lbolla opened this issue Sep 9, 2020 · 0 comments

Comments

@lbolla
Copy link

lbolla commented Sep 9, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant