~taiite

France

http://taiite.srht.site/

~taiite/public-inbox

Last active a month ago
View more

Recent activity

Re: [PATCH 1/2] PostgreSQL support a day ago

From Hubert Hirtz to ~emersion/soju-dev

On Tue, 14 Sep 2021 15:35:00 +0200, minus wrote:
> On 13/09/2021 23.34, Hubert Hirtz wrote:
> > - All statements are prepared beforehand for performance, and it also
> >    allowed us to read Java-levels of boilerplate.  
> That's really not nice to read. The $1, … parameters to SQL queries are 
> bad enough as it is, having the query away from the parameters being 
> passed is just awful. I'd probably just skip on the prepared statements, 
> I doubt there's ever a notable performance difference. 

I don't have any opinion on that, nor made measurements.  It just
seemed like a free improvement.  If emersion doesn't want prepared
statements then I'll remove them.

> Alternatively 

[PATCH] Use NULL-tolerant comparison for DeliveryReceipts 2 days ago

From Hubert Hirtz to ~emersion/soju-dev

Since NULL = NULL is always FALSE, this query needs to use IS instead.
This should fix the flood of DeliveryReceipts in the DB.

See https://www.sqlite.org/lang_expr.html

> The IS and IS NOT operators work like = and != except when one or both
> of the operands are NULL. In this case, if both operands are NULL,
> then the IS operator evaluates to 1 (true) and the IS NOT operator
> evaluates to 0 (false). If one operand is NULL and the other is not,
> then the IS operator evaluates to 0 (false) and the IS NOT operator is
> 1 (true). It is not possible for an IS or IS NOT expression to
> evaluate to NULL.
---
[message trimmed]

[PATCH 2/2] Add a script to migrate from SQLite to PostgreSQL 3 days ago

From Hubert Hirtz to ~emersion/soju-dev

---

Limitation: PostgreSQL seems to handle neither quoted values in CSV, nor
multi-char delimiters, so the script will fail on weird content and
passwords...

 contrib/sqlite2pg.sh | 129 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
 create mode 100755 contrib/sqlite2pg.sh

diff --git a/contrib/sqlite2pg.sh b/contrib/sqlite2pg.sh
new file mode 100755
index 0000000..5d65ee5
--- /dev/null
[message trimmed]

[PATCH 1/2] PostgreSQL support 3 days ago

From Hubert Hirtz to ~emersion/soju-dev

---

Now soju accepts "db postgres ..." in the config. See doc/soju.1.scd.

Implem notes and TBDs:
- I don't see how it's possible to query the schema version without
  doing plpgsql, or some grep magic on tx.Query() error code, so I did
  plpgsql.
- All statements are prepared beforehand for performance, and it also
  allowed us to read Java-levels of boilerplate.
- I used database/sql since it's also what's used for db_sqlite.go, but
  I heard on "Hacker" "News" there are other (better) drivers out there,
  especially for PostgreSQL-only features like arrays, etc.
[message trimmed]

[PATCH] Fix DeliveryReceipt not being cleaned up 3 days ago

From Hubert Hirtz to ~emersion/soju-dev

---
 db_sqlite.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/db_sqlite.go b/db_sqlite.go
index 6413acc..7c0840a 100644
--- a/db_sqlite.go
+++ b/db_sqlite.go
@@ -289,6 +289,17 @@ func (db *SqliteDB) DeleteUser(id int64) error {
	}
	defer tx.Rollback()

	_, err = tx.Exec(`DELETE FROM DeliveryReceipt
		WHERE id IN (
[message trimmed]

[PATCH] Explicitly close connection to SQLite on failed upgrade 3 days ago

From Hubert Hirtz to ~emersion/soju-dev

---
 db_sqlite.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/db_sqlite.go b/db_sqlite.go
index 58ea072..6413acc 100644
--- a/db_sqlite.go
+++ b/db_sqlite.go
@@ -150,6 +150,7 @@ func OpenSqliteDB(driver, source string) (Database, error) {

	db := &SqliteDB{db: sqlSqliteDB}
	if err := db.upgrade(); err != nil {
		sqlSqliteDB.Close()
		return nil, err
[message trimmed]

Re: [PATCH protodump] Make prototypes names bold a month ago

From Hubert Hirtz to ~taiite/public-inbox

Indeed ! Thanks for the patch and for the feedback. Pushed

Re: [PATCH senpai] ui: fix editor tests a month ago

From Hubert Hirtz to ~taiite/public-inbox

Thanks for keeping the tests up to date.

Pushed the patch.