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

Map property to column xmin #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

asymetrixs
Copy link

The column "xmin" is a default hidden column for every table in PostgreSQL. In order to use the concurrency feature, the best is to map a property to this auto-updating column. If it is just done as described in the docs now, with a random column name mapped to type 'xid', the column value remains at its default 0 on insert and upate.

The column "xmin" is a default hidden column for every table in PostgreSQL. In order to use the concurrency feature, the best is to map a property to this auto-updating column.
If it is just done as described in the docs now, with a random column name mapped to type 'xid', the column value remains at its default 0 on insert and upate.
@asymetrixs
Copy link
Author

asymetrixs commented Nov 29, 2024

I noticed, that doing this leads to the following error message when using .Distinct() since apparently the DISTINCT operation is not supported on columns of type xid:

      Unhandled exception rendering component: 0A000: could not implement DISTINCT
      
      DETAIL: Some of the datatypes only support hashing, while others only support sorting.
      Npgsql.PostgresException (0x80004005): 0A000: could not implement DISTINCT
      
      DETAIL: Some of the datatypes only support hashing, while others only support sorting.
         at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
         at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
         at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
         at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
         at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
         at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
         at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
        [...]
        Exception data:
          Severity: ERROR
          SqlState: 0A000
          MessageText: could not implement DISTINCT
          Detail: Some of the datatypes only support hashing, while others only support sorting.
          File: planner.c
          Line: 4787
          Routine: create_distinct_paths

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

Successfully merging this pull request may close these issues.

1 participant