Skip to content

fix(postgres): explain a dropped table instead of raw driver text - #91366

Open
Gilbert09 wants to merge 1 commit into
masterfrom
posthog/postgres-missing-relation-message
Open

fix(postgres): explain a dropped table instead of raw driver text#91366
Gilbert09 wants to merge 1 commit into
masterfrom
posthog/postgres-missing-relation-message

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

When a table or column a Postgres sync reads is dropped or renamed on the source, the sync stopped, which is correct, but stored the raw psycopg error as latest_error: relation "..." does not exist followed by a SQL fragment. The customer got no next step, and the message echoed their own relation name and query back into the error panel.

Changes

  • A dropped or renamed table or column now shows "A table or column this sync reads no longer exists in your source database. Remove it...", instead of the raw driver text. The failure stays non-retryable.
  • Give the existing does not exist non-retryable bucket an actionable message. It was None, which fell back to the raw text.
  • Mechanical: a Postgres test asserts the message is surfaced. The Supabase realtime-partition test is updated, because a regular missing relation now gets this generic message while realtime partitions keep their specific one through first-match selection.

How did you test this code?

Ran TestPostgresSourceNonRetryableErrors and the Supabase source tests. Added test_missing_relation_surfaces_actionable_message, which catches a revert of the bucket back to None or raw text. Reworked the Supabase parametrized test to assert realtime partitions keep their specific message while other dropped relations get the generic one. Did not run the full warehouse suite, because this sandbox has no dev stack.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Fully autonomous

Found while triaging a batch of production warehouse sync failure classes. Skills invoked: /writing-user-facing-copy, /writing-tests, /writing-code-comments, /writing-pr-descriptions.

The does not exist key is deliberately broad; it already caught both relation and column drops, and the new message covers both. Supabase inherits this bucket and keeps its realtime-partition message ahead of it. Relation names in the tests are invented.


Created with PostHog Desktop

When a table or column a sync reads is dropped or renamed on the source, the
streaming query fails with "relation ... does not exist" (or the column variant).
That was already non-retryable, but the stored latest_error was the raw psycopg
text, which echoes the relation name and a SQL fragment back and gives no next step.
Give the bucket an actionable message. Supabase's realtime-partition message still
wins for those partitions through first-match selection.

Generated-By: PostHog Desktop
Task-Id: c515c2ae-d0fd-42c5-81fc-44b3650ff0ae
@trunk-io

trunk-io Bot commented Aug 30, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Gilbert09! 👋

It looks like your git author email on this PR isn't your @posthog.com address (owerstom@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team August 30, 2026 11:02
@github-actions

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@Gilbert09 Gilbert09 added the stamphog Request AI approval (no full review) label Aug 30, 2026 — with PostHog
@trunk-io

trunk-io Bot commented Aug 30, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant