adjust / parquet_fdw

Parquet foreign data wrapper for PostgreSQL
PostgreSQL License
333 stars 37 forks source link

crash if array column imported with incorrect type. #25

Closed jefbarn closed 3 years ago

jefbarn commented 3 years ago

Found when playing with my data that sometimes I was importing a array/list column as just an int, which would cause the db to crash when selecting the table.

Adapted from your test cases:

CREATE FOREIGN TABLE example1 (
    one     INT8,
    two     INT8,  -- Wrong should be INT8[]
    three   TEXT,
    four    TIMESTAMP,
    five    DATE,
    six     BOOL,
    seven   FLOAT8)
SERVER parquet_srv
OPTIONS (filename 'example1.parquet', sorted 'one');
SELECT * FROM example1;  -- Crash!
zilder commented 3 years ago

Hi @jefbarn,

Thanks for the report! I'll look into this.

jefbarn commented 3 years ago

@zilder 🎉 Thank you!

zilder commented 3 years ago

@jefbarn I forgot that github automatically closes issues : ) So yeah, i found the bug. In short i wasn't careful with exception handling and accidentally used continue inside PG_TRY/PG_CATCH block which led to corruption of the stack of setjmps/longjmps (this is how postgres does exception handling).

Thanks again for the report!