PostHog / posthog

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
19.39k stars 1.13k forks source link

fix(plugin-server): fix conflict case in addPersonlessDistinctId #23378

Closed bretthoerner closed 3 days ago

bretthoerner commented 3 days ago

Problem

Didn't realize ON CONFLICT ... DO NOTHING doesn't return the RETURNING on a conflict... annoying.

Changes

Fix by doing followup SELECT, this should be ~rare because we have an LRU cache to tell us if we can skip trying the insert.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Added test