diff --git a/GRDB/Core/Database+Schema.swift b/GRDB/Core/Database+Schema.swift index 1525912c3..68f459a9e 100644 --- a/GRDB/Core/Database+Schema.swift +++ b/GRDB/Core/Database+Schema.swift @@ -1606,7 +1606,19 @@ extension ForeignKeyViolation: CustomStringConvertible { /// pk.columns // ["citizenID", "countryIsoCode"] /// pk.rowIDColumn // nil /// pk.isRowID // false +/// +/// // CREATE TABLE passport ( +/// // id INTEGER PRIMARY KEY, +/// // name TEXT +/// // ) WITHOUT ROWID +/// let pk = try db.primaryKey("passport") +/// pk.columns // ["id"] +/// pk.rowIDColumn // nil +/// pk.isRowID // false /// ``` +/// +/// An `INTEGER PRIMARY KEY` is an alias for the rowid only in rowid +/// tables. In a `WITHOUT ROWID` table, it is a regular primary key. public struct PrimaryKeyInfo: Sendable { private enum Impl { /// The hidden rowID. @@ -1660,7 +1672,9 @@ public struct PrimaryKeyInfo: Sendable { } /// When not nil, the name of the column that contains the - /// `INTEGER PRIMARY KEY`. + /// `INTEGER PRIMARY KEY` of a rowid table. + /// + /// This is nil for `WITHOUT ROWID` tables, which have no rowid. public var rowIDColumn: String? { switch impl { case .hiddenRowID: