Skip to content

Conversation

@Julienng
Copy link

@Julienng Julienng commented Jan 21, 2026

Hi!

When using the page https://tanstack.com/feed?page=1&pageSize=50&viewMode=table&libraries=%5B%22router%22%5D

The query in Drizzle is failing because of an incorrect query generation:

select "id", "entry_id", "entry_type", "title", "content", "excerpt", "published_at", "created_at", "updated_at", "metadata", "library_ids", "partner_ids", "tags", "show_in_feed", "featured", "auto_synced", "last_synced_at"
from "feed_entries"
where (
       "feed_entries"."show_in_feed" = $1
  and  "feed_entries"."published_at" >= $2
  and  "feed_entries"."published_at" <= $3
  and  "feed_entries"."library_ids" && ARRAY[$4]::text[]
)--                                    ~~~~~~~~~
--                                         ^-- sql driver is not happy with that
order by "feed_entries"."published_at" DESC
-- params: true,1970-01-01T00:00:00.000Z,2026-01-21T18:35:09.396Z,router

By looking and searching at the Drizzle doc, I've found arrayOverlaps(posts.tags, ['Typescript', 'ORM']) (https://orm.drizzle.team/docs/operators#arrayoverlaps)

When looking at the generated query, it looks like this:

select "id", "entry_id", "entry_type", "title", "content", "excerpt", "published_at", "created_at", "updated_at", "metadata", "library_ids", "partner_ids", "tags", "show_in_feed", "featured", "auto_synced", "last_synced_at"
from "feed_entries"
where (
       "feed_entries"."show_in_feed" = $1
  and  "feed_entries"."published_at" >= $2
  and  "feed_entries"."published_at" <= $3
  and  "feed_entries"."library_ids" && $4
)
order by "feed_entries"."published_at" DESC
-- params: true,"1970-01-01T00:00:00.000Z","2026-01-21T18:45:32.506Z","{\"start\"}"

So the query's initial behavior is maintained but without an SQL error.

PR Status:

  • I have no data locally to test the query behavior; it should be the same (&& predicate is kept)
  • The SQL error is fixed
  • I was blocked because of the pre-commit hook locally; I had to --no-verify to get to the PR. need a check if everything is good
  • I've migrated all ARRAY[${sql.join patterns, but two of them needed a cast for the enum values: filters.useCases and data.capabilityFilter

@netlify
Copy link

netlify bot commented Jan 21, 2026

👷 Deploy request for tanstack pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 24ca308

@Julienng Julienng force-pushed the fix-feed-array-overlaps-predicates branch from 89fff6b to 24ca308 Compare January 22, 2026 11:36
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

Successfully merging this pull request may close these issues.

1 participant