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

sql: implement pg_terminate_backend [originally: EnsureDeleted does not work in .NET EFCore] #95160

Open
balloman opened this issue Jan 12, 2023 · 4 comments
Labels
A-sql-builtins SQL built-in functions and semantics thereof. A-sql-pgcompat Semantic compatibility with PostgreSQL A-tools-efcore O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner

Comments

@balloman
Copy link

balloman commented Jan 12, 2023

Trying to use ensure deleted fails with the exception

Npgsql.PostgresException: 42883: unknown function: pg_terminate_backend()
    at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|226_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)

Jira issue: CRDB-23379

@blathers-crl
Copy link

blathers-crl bot commented Jan 12, 2023

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I have CC'd a few people who may be able to assist you:

  • @cockroachdb/sql-sessions (found keywords: pg_)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Jan 12, 2023
@ecwall ecwall added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jan 12, 2023
@ecwall
Copy link
Contributor

ecwall commented Jan 12, 2023

It looks like this similar issue was closed back in 2019 #35897.

@rafiss I saw you commented on it here #35897 (comment) - do you think we can implement the function by having the server close the connection or have it be a no-op so that there is not a client side error?

@ecwall ecwall added the A-sql-builtins SQL built-in functions and semantics thereof. label Jan 12, 2023
@rafiss
Copy link
Collaborator

rafiss commented Jan 12, 2023

do you think we can implement the function by having the server close the connection

This doesn't seem possible, since the PID is not enough to uniquely identify the connection. It's a 32-bit value, but it can't just be random bits because of the design described in the query cancellation RFC.

or have it be a no-op so that there is not a client side error?

Maybe this is an option. But I'm worried that it could cause confusion if the command completes successfully but doesn't do anything. People may view that as a bug or even a security issue.


I think this could be reported to the npgsql/efcore.pg repo. It seems like pg_terminate_backend function is only called in one place, so maybe there is a workaround that can be added if CockroachDB is being used. That project has other CRDB-specific code, so maybe this could be another time to do that.

@dikshant
Copy link

This should be addressed as part of #92623

@rafiss rafiss changed the title EnsureDeleted does not work in .NET npgsql EnsureDeleted does not work in .NET EFCore Feb 23, 2023
@rafiss rafiss changed the title EnsureDeleted does not work in .NET EFCore sql: implement pg_terminate_backend [orig: EnsureDeleted does not work in .NET EFCore] Dec 5, 2023
@rafiss rafiss added the A-sql-pgcompat Semantic compatibility with PostgreSQL label Dec 5, 2023
@rafiss rafiss changed the title sql: implement pg_terminate_backend [orig: EnsureDeleted does not work in .NET EFCore] sql: implement pg_terminate_backend [originally: EnsureDeleted does not work in .NET EFCore] Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-builtins SQL built-in functions and semantics thereof. A-sql-pgcompat Semantic compatibility with PostgreSQL A-tools-efcore O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

No branches or pull requests

4 participants