Skip to content

Commit eff8949

Browse files
committed
use correct txid function
returns a 32-bit integer that matches the txid assigned to electric changes
1 parent 7047d5e commit eff8949

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/phoenix/sync/writer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ if Code.ensure_loaded?(Ecto) do
14131413
end
14141414

14151415
@txid_name {:__phoenix_sync__, :txid}
1416-
@txid_query "SELECT txid_current()::text as txid"
1416+
@txid_query "SELECT pg_current_xact_id()::xid as txid"
14171417

14181418
defp start_multi do
14191419
Ecto.Multi.new()

test/phoenix/sync/writer_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ defmodule Phoenix.Sync.WriterTest do
135135
end
136136

137137
defp is_txid(txid) do
138-
is_binary(txid) && match?({_, ""}, Integer.parse(txid))
138+
is_integer(txid)
139139
end
140140

141141
# new creates without applying (so doesn't need a repo)

0 commit comments

Comments
 (0)