Skip to content

Commit

Permalink
Added xmin to PostgresLockStatementFormatter.cs queries to allow for …
Browse files Browse the repository at this point in the history
…EF-style optimistic concurrency checking.
  • Loading branch information
phatboyg committed May 1, 2024
1 parent 25fd050 commit 12563fa
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class PostgresLockStatementFormatter :
{
public void Create(StringBuilder sb, string schema, string table)
{
sb.AppendFormat("SELECT * FROM {0} WHERE ", FormatTableName(schema, table));
sb.AppendFormat("SELECT *, xmin FROM {0} WHERE ", FormatTableName(schema, table));
}

public void AppendColumn(StringBuilder sb, int index, string columnName)
Expand All @@ -26,7 +26,7 @@ public void Complete(StringBuilder sb)

public void CreateOutboxStatement(StringBuilder sb, string schema, string table, string columnName)
{
sb.AppendFormat(@"SELECT * FROM {0} ORDER BY ""{1}"" LIMIT 1 FOR UPDATE SKIP LOCKED", FormatTableName(schema, table), columnName);
sb.AppendFormat(@"SELECT *, xmin FROM {0} ORDER BY ""{1}"" LIMIT 1 FOR UPDATE SKIP LOCKED", FormatTableName(schema, table), columnName);
}

static string FormatTableName(string schema, string table)
Expand Down

0 comments on commit 12563fa

Please sign in to comment.