0

I am using Sequelize to interact with my Postgres database. Recently, the QA team pointed out that special characters like @, #, etc. are ignored in the sorting while we wanted Javascript-like sorting. I was somehow able to fix the issue in one place using the following code:

order: [
          [
            sequelize.fn(
              'convert_to',
              sequelize.fn(
                'lower',
                sequelize.literal( `"${ column_name }" COLLATE "en_US"` )
              ),
              'UTF8' )
            , 'ASC' ]
        ],

However, I am looking for some config-level change that fixes the issue everywhere in the code. Is that possible? Any help is highly appreciated.

Sandeep Parashar
  • 197
  • 1
  • 14
  • Does this answer your question? [Node, Sequelize, Mysql - How to define collation and charset to models?](https://stackoverflow.com/questions/41666820/node-sequelize-mysql-how-to-define-collation-and-charset-to-models) – Zegarek Nov 25 '22 at 08:54
  • What sorting rule is set for DB? – Anatoly Nov 26 '22 at 08:27
  • @Anatoly, as I review the DB level definition, Encoding is UTF8 and Collation is en_US.UTF-8 which seems fine to me. – Sandeep Parashar Dec 01 '22 at 07:56
  • Could you show int the post the current order of records and required order of records (including special characters)? – Anatoly Dec 01 '22 at 17:37

0 Answers0