Document INTEGER PRIMARY KEY in WITHOUT ROWID tables

This commit is contained in:
Chris Kolbu committed 2026-08-18 19:55:41 +10:00
1 parent 4373b3a49b
commit 8511cfd399
1 file changed
+15 -1
+15 -1
View File
@@ -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: