adjust / parquet_fdw

Parquet foreign data wrapper for PostgreSQL
PostgreSQL License
351 stars 38 forks source link

query with self join does not work properly #62

Closed lenagol closed 4 months ago

lenagol commented 1 year ago

Hi,

I'm trying to run query with self join and does not get results as expected Example: below is data table

postgres=# select * from t5; postgres_index | postgres_recordtype | val ----------------+---------------------+----- 0 | all | 1 1 | all | 2 2 | all | 3 (3 rows)

the query is:

postgres=# select C.val, P.val from t5 as C, (select * from t5 where (val > 1) ) as P where (C.val < P.val); val | val -----+----- (0 rows)

Expected result is pairs (1,2),(1,3),(2,3)

If I use operator '=' in condition where (C.val = P.val), it works correct. But when I use operators <,<=,>,>= empty result is returned

Additionally, I checked it with native postgres table -- it works as expected

postgres=# create table pgtable (val int); postgres=# insert into pgtable (val) values (1),(2),(3); postgres=# select C.val, P.val from pgtable as C, (select * from pgtable where (val > 1) ) as P where (C.val < P.val); val | val -----+----- 1 | 2 1 | 3 2 | 3 (3 rows)

Thanks!

za-arthur commented 4 months ago

Thanks @lenagol for the report. This issue should have been fixed by the PR https://github.com/adjust/parquet_fdw/pull/83. I'm closing the issue. Feel free to reopen it if you still see the issue.