Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add support for pushdown of UNION queries when they all query the remote

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
c, clickhouse, postgresql
Domain
databases

Research direction

Start by studying PostgreSQL's prepunion.c and the GetForeignUpperPaths hook mentioned in the discussion. Determine what core infrastructure is missing for recognizing UNION branches that all belong to the same FDW, then define completion as pushing down UNION queries whose SELECT statements all read from the remote ClickHouse source.

Written by the indexing model from the issue text.

Description

enhancement pushdown

From the Postgres Hackers Discord:

@theory: In an FDW, is there a way to push down a union query when each select within it is from a foreign table?

@Robert Haas: i'm not sure if it's possible, but if it is possible, i would guess that it involves GetForeignUpperPaths

@theory: I need a tutorial for this stuff…

@tgl: In principle we could support that I think, but I bet there's missing infrastructure that would make it hard. In the case of joins there's some in-core code that recognizes when all the joined tables belong to the same FDW, but I don't think prepunion.c has any equivalent. If you're excited about this I suggest working on a patch for that, rather than trying to figure out how to do it without any core support.

@theory: Thanks, super useful information. Will keep it in my mental backlog for sure as I work through learning the FDW stuff, see where there are gaps, and figure out which to try to plug first.

Dominant language
C
Stars
284
Forks
21
Avg merge
1d 3h
Merged PRs (30d)
22

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ClickHouse/pg_clickhouse

All issues in ClickHouse/pg_clickhouse

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.