]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Use String for PostgreSQL xmin example
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 26 Nov 2020 17:28:19 +0000 (12:28 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 26 Nov 2020 17:28:19 +0000 (12:28 -0500)
Fixes: #5728
Change-Id: I1efd6296018a80470b8c215b225898bbfea742a8

doc/build/orm/versioning.rst

index 2697884f0d5e4a718e801964f76f798ef8fe54fc..64bc706e5ba251f252dab1fa46860fa722f73807 100644 (file)
@@ -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