eventflow / EventFlow

Async/await first CQRS+ES and DDD framework for .NET
https://docs.geteventflow.net/
Other
2.33k stars 442 forks source link

ReadModelSqlGenerator Column Prefix and Suffix - Not Used in Select Query #1002

Open VladislavRybnikov opened 10 months ago

VladislavRybnikov commented 10 months ago

Hi!

I am using PostgreSQL read models and discovered an issue with the column names.

STR

  1. I created all tables with double-quoted values for table and column names using FluentMigrator (this is the default FluentMigrator PostgreSQl configuration).
  2. I registered PostgreSql readModels using ConfigurePostgreSql and UsePostgreSqlReadModel
  3. I added [PostgreSqlReadModelIdentityColumn] attribute to ReadModel's property Id

AR When working with read models I am receiving an error from PostgreSQL that column id does not exists

ER Should work well with such configuration by default OR should be configured by registering custom ReadModelSqlGenerator:

internal sealed class CustomPostgresReadModelSqlGenerator : ReadModelSqlGenerator
{
    public CustomPostgresReadModelSqlGenerator()
        : base(new ReadModelSqlGeneratorConfiguration(
            tableQuotedIdentifierPrefix: "\"",
            tableQuotedIdentifierSuffix: "\"",
            columnQuotedIdentifierPrefix: "\"",
            columnQuotedIdentifierSuffix: "\""))
    {
    }
}

But even registration of this custom ReadModelSqlGenerator does not help, because probably there is a bug in ReadModelSqlGenerator. https://github.com/eventflow/EventFlow/blob/cf4287b4de914cba07c9a85f43228dba6a8908a6/Source/EventFlow.Sql/ReadModels/ReadModelSqlGenerator.cs#L105 - on this line prefix and suffix - not used at all, so probably it is a bug, because they are used here - https://github.com/eventflow/EventFlow/blob/cf4287b4de914cba07c9a85f43228dba6a8908a6/Source/EventFlow.Sql/ReadModels/ReadModelSqlGenerator.cs#L149 .

Also, there is a question, why columnQuotedIdentifierPrefix: "\"" and columnQuotedIdentifierSuffix: "\"" - not used by default for PostgreSql configuration?

github-actions[bot] commented 7 months ago

Hello there!

We hope you are doing well. We noticed that this issue has not seen any activity in the past 90 days. We consider this issue to be stale and will be closing it within the next seven days.

If you still require assistance with this issue, please feel free to reopen it or create a new issue.

Thank you for your understanding and cooperation.

Best regards, EventFlow