Skip to content

fix: do not retry transactions on 40001 SQL error - #4222

Merged
laurenceisla merged 1 commit into
PostgREST:mainfrom
laurenceisla:fix/transaction-no-retry
Apr 27, 2026
Merged

fix: do not retry transactions on 40001 SQL error#4222
laurenceisla merged 1 commit into
PostgREST:mainfrom
laurenceisla:fix/transaction-no-retry

Conversation

@laurenceisla

@laurenceisla laurenceisla commented Jul 23, 2025

Copy link
Copy Markdown
Member

Should close #3673.

@laurenceisla
laurenceisla force-pushed the fix/transaction-no-retry branch 3 times, most recently from 1afa5fb to 665f55c Compare August 13, 2025 01:48
@steve-chavez

Copy link
Copy Markdown
Member

Should we vendor hasql-notifications for now since there's no response for diogob/hasql-notifications#30 ?

I remember we did this before too. It's a single file so no major maintenance problem there IMO.

@wolfgangwalther

Copy link
Copy Markdown
Member

We should not vendor it, for two reasons:

  • First of all, we haven't even done our own work, yet. We can't update to hasql 1.8 or 1.9 before the static build is sorted out - and it currently doesn't look like there will be progress soon. The upstream Nixpkgs PR that Build static executable for linux aarch64 (w/ TH) #4193 depends on is likely not going to get merged - and currently Nixpkgs is not even able to build pkgsStatic.libpq anmyore. This only worked by accident. Thus, upgrading to GHC 9.6 and then hasql is quite far out of reach for us right now.
  • 3 weeks without reaction is not "no reaction", imho. Especially when there has been no additional ping in the PR, yet, etc.

@laurenceisla
laurenceisla force-pushed the fix/transaction-no-retry branch 3 times, most recently from ff133bf to 23426d2 Compare August 14, 2025 19:28
@laurenceisla

laurenceisla commented Aug 14, 2025

Copy link
Copy Markdown
Member Author

3 weeks without reaction is not "no reaction", imho. Especially when there has been no additional ping in the PR, yet, etc.

Thanks for the ping suggestion (I should've done this weeks ago). Changes are now merged and released upstream!

First of all, we haven't even done our own work, yet. We can't update to hasql 1.8 or 1.9 before the static build is sorted out - and it currently doesn't look like there will be progress soon.

OK, so this would be the only blocker for this PR for now then. Also some stack shenanigans, but will fix after this is sorted.

@laurenceisla
laurenceisla force-pushed the fix/transaction-no-retry branch 2 times, most recently from 4fd5a69 to 592802c Compare April 23, 2026 01:15
@wolfgangwalther
wolfgangwalther force-pushed the fix/transaction-no-retry branch 2 times, most recently from 505b11b to 32b8f4d Compare April 27, 2026 09:13
@laurenceisla
laurenceisla marked this pull request as ready for review April 27, 2026 13:36
Comment thread nix/tools/withTools.nix
@laurenceisla
laurenceisla force-pushed the fix/transaction-no-retry branch from 32b8f4d to c82b65e Compare April 27, 2026 18:56
@laurenceisla laurenceisla changed the title fix: do not retry transactions on any error fix: do not retry transactions on 40001 SQL error Apr 27, 2026
@laurenceisla
laurenceisla merged commit 41b86ff into PostgREST:main Apr 27, 2026
35 of 36 checks passed
@laurenceisla
laurenceisla deleted the fix/transaction-no-retry branch April 27, 2026 19:30
@steve-chavez

Copy link
Copy Markdown
Member

@laurenceisla Possible to backport? Would it be hard because it depends on a newer nixpkgs?

@laurenceisla

laurenceisla commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

Would it be hard because it depends on a newer nixpkgs?

Yes, I'm afraid it will result in a similar case as #4702 (comment), due to the dependencies.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Surprising infinite retrying of SQL statement on a replica causes replication lag

3 participants