getCurrentPostgreSQLXID gets the current PostgreSQL transaction ID
(ctx context.Context)
| 111 | |
| 112 | // getCurrentPostgreSQLXID gets the current PostgreSQL transaction ID |
| 113 | func (p *Postgres) getCurrentPostgreXID(ctx context.Context) (uint64, error) { |
| 114 | var x int64 |
| 115 | query := "SELECT COALESCE(pg_current_xact_id()::text, '0')::bigint" |
| 116 | if err := p.ReadPool.QueryRow(ctx, query).Scan(&x); err != nil { |
| 117 | return 0, err |
| 118 | } |
| 119 | return uint64(x), nil |
| 120 | } |
| 121 | |
| 122 | // getMaxReferencedXID gets the maximum transaction ID referenced in the transactions table |
| 123 | func (p *Postgres) getMaxReferencedXID(ctx context.Context) (uint64, error) { |
no test coverage detected