From 1cb05352a3dc40c1c6245a28af401ca7a4bddd1f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 26 Nov 2020 12:28:19 -0500 Subject: [PATCH] Use String for PostgreSQL xmin example Fixes: #5728 Change-Id: I1efd6296018a80470b8c215b225898bbfea742a8 --- doc/build/orm/versioning.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/build/orm/versioning.rst b/doc/build/orm/versioning.rst index 2697884f0d..64bc706e5b 100644 --- a/doc/build/orm/versioning.rst +++ b/doc/build/orm/versioning.rst @@ -153,7 +153,7 @@ class as follows:: id = Column(Integer, primary_key=True) name = Column(String(50), nullable=False) - xmin = Column("xmin", Integer, system=True, server_default=FetchedValue()) + xmin = Column("xmin", String, system=True, server_default=FetchedValue()) __mapper_args__ = { 'version_id_col': xmin, @@ -167,7 +167,9 @@ automatically providing the new value of the version id counter. In the above scenario, as ``xmin`` is a system column provided by PostgreSQL, we use the ``system=True`` argument to mark it as a system-provided - column, omitted from the ``CREATE TABLE`` statement. + column, omitted from the ``CREATE TABLE`` statement. The datatype of this + column is an internal PostgreSQL type called ``xid`` which acts mostly + like a string, so we use the :class:`_types.String` datatype. The ORM typically does not actively fetch the values of database-generated -- 2.47.3