Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
VladislavRybnikov opened this issue Aug 17, 2023 · 1 comment

Comments

@VladislavRybnikov
Copy link

VladislavRybnikov commented Aug 17, 2023

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.

sql = $"SELECT * FROM {tableName} WHERE {identityColumn} = @EventFlowReadModelId";
- on this line prefix and suffix - not used at all, so probably it is a bug, because they are used here -
sql = $"UPDATE {tableName} SET {updateColumns} WHERE {Configuration.ColumnQuotedIdentifierPrefix}{identityColumn}{Configuration.ColumnQuotedIdentifierSuffix} = @{identityColumn} {versionCheck}";
.

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

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants