Skip to content

Calling "icu_load_collation" and connections and concurrency #1357

@gerricom

Description

@gerricom

I need to apologize upfront: This is going to be kind of a noob question, because I'm not yet understanding all bits and pieces. I'll really appreciate it, if someone could give me some insights.

I'm currently building a little web application with a sqlite3 database. I'm living in Germany and some of the later users are used to some sorting conventions for strings here. So I build my app with sqlite_icu and then I can call SELECT icu_load_collation('de_DE', 'german_ai_ci', 'PRIMARY') to register my collation and use it later for sorting.

This works as planned as long as I do this in a little CLI script. When using my web app setup with GORM, this won't work reliable and some queries fail with no such collation sequence: german_ai_ci- but not all of them. So I learned that I can have multiple connections and my SELECT runs only in one of them. That brings me to some questions:

  • It seems to be a stupid idea to limit the open connections via db.SetMaxOpenConns(1)... or am I wrong?
  • What other options do I have? I guess it is not that wise to run icu_load_collation before every SELECT statement...?
  • Are there any "after open connection" events/hooks/younameit I can use to issue that load function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions