From 78271d9204b00c0f33e575a3b885e99e15b9c159 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 5 Apr 2023 12:56:12 -1000 Subject: [PATCH] doc: cli: mention SQLite primary key workaround (fix #2017) --- hledger/hledger.m4.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 1c9e0fd89..df6eb42cf 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -607,7 +607,13 @@ Some notes about the various output formats: - This is not yet much used; real-world feedback is welcome. -- SQL output is expected to work with sqlite, MySQL and PostgreSQL +- SQL output is expected to work at least with SQLite, MySQL and Postgres. + +- For SQLite, it will be more useful if you modify the generated `id` field + to be a PRIMARY KEY. Eg: + ``` + $ hledger print -O sql | sed 's/id serial/id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL/g' | ... + ``` - SQL output is structured with the expectations that statements will be executed in the empty database. If you already have tables created