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

column "Message" does not exist while using postgresql as db provider #157

Open
amirelkassar opened this issue Nov 10, 2024 · 4 comments
Open
Assignees

Comments

@amirelkassar
Copy link

amirelkassar commented Nov 10, 2024

Describe the bug
I'm receiving an Npgsql.PostgresException with error code 42703, indicating that the column "Message" does not exist in the PostgreSQL database. This error occurs when trying to fetch logs using Serilog.Ui.PostgreSqlProvider. The error suggests that the query might be referencing "Message" instead of "message" or another case-sensitive variant.

To Reproduce
Steps to reproduce the behavior:

  1. Set up Serilog with Serilog.Ui.PostgreSqlProvider in a PostgreSQL database where logs are stored.
  2. Click on '....'
  3. Observe the error message about the missing "Message" column.

Expected behavior
The logs should be retrieved successfully without a case-sensitive column mismatch.

Error Message
Npgsql.PostgresException (0x80004005): 42703: column "Message" does not exist Position: 8 at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) ... Exception data: Severity: ERROR SqlState: 42703 MessageText: column "Message" does not exist Hint: Perhaps you meant to reference the column "logs.message". Position: 8 File: parse_relation.c Line: 3738 Routine: errorMissingColumn

Additional context
Add any other context about the problem here.

@mo-esmp
Copy link
Member

mo-esmp commented Nov 18, 2024

Could you specify the PostgreSQL sink you are using? PostgreSQL or PostgreSQLalternative?

@mo-esmp mo-esmp self-assigned this Nov 18, 2024
@lonix1
Copy link

lonix1 commented Nov 22, 2024

Same problem here. I'm using the "alternative" provider.

Note that in my case the "Message" column really is missing. I don't include it as I rely on the "MessageTemplate" instead (inside the json column).

I see that the column names are defined here. I don't use those. Am I still able to use this package?


UPDATE

I found some instructions for customisation, so I did this:

public class CustomPostgresLogModel : PostgresLogModel {
  [RemovedColumn] public override string? Exception { get; set; }
  // cannot do this as they are sealed:
  //[RemovedColumn] public override string? Message { get; set; }
  //[RemovedColumn] public override DateTime Timestamp { get; set; }
}

@followynne
Copy link
Member

Same problem here. I'm using the "alternative" provider.

Note that in my case the "Message" column really is missing. I don't include it as I rely on the "MessageTemplate" instead (inside the json column).

I see that the column names are defined here. I don't use those. Am I still able to use this package?

UPDATE

I found some instructions for customisation, so I did this:

public class CustomPostgresLogModel : PostgresLogModel {
  [RemovedColumn] public override string? Exception { get; set; }
  // cannot do this as they are sealed:
  //[RemovedColumn] public override string? Message { get; set; }
  //[RemovedColumn] public override DateTime Timestamp { get; set; }
}

hello @lonix1

as a design choice, Message column is not removable as it's required for the UI current page (as you'll see from screenshots sample, it's part of the required columns).

@lonix1
Copy link

lonix1 commented Nov 24, 2024

Yes I realised that once I started tinkering with this library, some columns are required. I think that will please many users, but not everyone as is always the case.

It would be nice in the future if it were possible to customise the UI's columns, but I'm sure that would be a lot of work. Thanks for the reply.

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

4 participants