Skip to content

pushdown doesn't work for 'where with timestamp' #318

@TheLazzziest

Description

@TheLazzziest

Context

Hi there!

I was testing a connection between postgres and mysql, so I started experiencing some issues when I was trying to employ time conditions in a query, such as:

 SELECT id, content, updated FROM dev.reviews WHERE dev.reviews.updated BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 day' AND CURRENT_TIMESTAMP LIMIT 100;

I got the following errors (one of) in a response:

  • ERROR: failed to store the result
  • server closed the connection unexpectedly
  • Error writing file '/tmp/MYfd=219' (OS errno 28 - No space left on device)

It looks like the condition is not pushed to the mysql instance, so postgres is trying to fetch everything it can.

If I remove the condtion, everything works as expected with expected performance.

Is is an issue or I just misused the extension ?

Here are the snippet for the adding a remote server:

CREATE EXTENSION IF NOT EXISTS mysql_fdw;
CREATE SCHEMA dev AUTHORIZATION postgres;
CREATE SERVER dev FOREIGN DATA WRAPPER mysql_fdw OPTIONS (host 'dev.db',port '3306',fetch_size '10000');
CREATE USER MAPPING FOR postgres SERVER dev OPTIONS (username 'root', password :'password');
GRANT USAGE ON FOREIGN SERVER dev TO postgres;
IMPORT FOREIGN SCHEMA dev LIMIT TO (reviews) FROM SERVER dev INTO dev OPTIONS (import_enum_as_text 'true');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions