Skip to content

Support for Cultures that uses separator of comma instead of dot. #6

@Josephvs96

Description

@Josephvs96

Hi,

I was facing a problem when trying to insert a vector with (1536 ) dimensions into a database and i kept getting the following exception

PostgresException: 22000: different vector dimensions 1536 and 3072 Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|234_0(NpgsqlConnector connector, bool async, DataRowLoadingMode dataRowLoadingMode, bool readingNotifications, bool isReadingPrependedMessage)

It turns out that because the default culture i have on my PC (Swedish) uses comma as decimal separator instead of dot, each floating number were considered two different numbers at the time of insert in the database.

image

Now i'm not really sure if there is some way to make this work on the database side of things. But my "fix" were to change the CurrentThread culture to be "en-GB". That worked but it might not be an option in the real word depending on how the UI is built and if we need to support different cultures.

One option could be to convert each floating point to a string with dot before joining the list with a comma.

And yes btw thanks a lot for this awesome library 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions