Skip to content

Conversation

@NodudeWasTaken
Copy link
Contributor

@NodudeWasTaken NodudeWasTaken commented Nov 5, 2025

My third attempt at good postgres integration.
I do have some gripes about how it was made.

  • It has alot of duplicate code because postgres and sqlite need different sql syntax.
  • Using group_by is a little annoying, but using distinct in postgres is simply painful.
  • Some of the filter builders could surely be shared.
  • I had to use a dev version of goqu to support "returning".
  • Fingerprints work a little weird in postgres because the codebase expects it to return the correct type from sql.
  • Perhaps the interfaces could work better with a shared Interfaces() function.
  • Basename in postgresql has questionable code.
  • Some SQL optimizations on the Scene and Images table could be backported to SQLite i think.
  • Custom fields are already json in postgresql, but not yet for sqlite.
  • I had to add a type migration for the custom fields to know how to migrate them and parse them.
  • I made a savepoint creator to avoid sql lockup from postgresql.
  • It could benefit from some setup instructions 😝

Overall it works very well though, i've been running it for some time now.

Postgres support in a seperate namespace from sqlite.
It contains alot of duplicated code for the sake of code maintainability.
Still requires the DLL for phash_distance, that cannot be moved into postgres code.

Set the database path to postgres:// to use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant