Skip to content

Conversation

@JusterZhu
Copy link
Collaborator

(1) Modify the branch enumeration for MD5SHA256.
(2) Remove unsupported syntax keywords in test cases for GaussDB.

/// <summary>
/// All authentication methods. For internal use.
/// </summary>
All = Password | MD5 | GSS | SSPI | ScramSHA256 | None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should All includes the MD5SHA256 also

sb.Append("SELECT pg_advisory_unlock_all();");
_resetWithoutDeallocateResponseCount += 2;
}
if (DatabaseInfo.SupportsDiscardSequences)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to set the value to false?

@WeihanLi WeihanLi requested a review from Copilot April 27, 2025 15:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to update the authentication branch to include MD5SHA256 support and remove unsupported syntax keywords from test cases (such as the CASCADE clause on DROP statements). Key changes include:

  • Removing the CASCADE keyword from DROP statements in several test cases.
  • Introducing a new MD5SHA256 enumeration and updating authentication handling accordingly.
  • Commenting out DISCARD commands in tests and internal connector code to accommodate unsupported syntax.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Npgsql.Tests/TestUtil.cs Removed CASCADE in DROP statements for temporary tables, schemas, views, functions, procedures, and types.
test/Npgsql.Tests/SecurityTests.cs & CommandTests.cs Commented out DISCARD ALL commands in tests.
test/Npgsql.Tests/BugTests.cs Removed CASCADE from DROP TYPE statement.
test/Npgsql.Tests/AsyncTests.cs Updated temporary table creation syntax and command organization.
src/Npgsql/NpgsqlConnectionStringBuilder.cs Added MD5SHA256 enumeration value.
src/Npgsql/Internal/NpgsqlConnector.cs Enabled MD5SHA256 authentication and commented out unsupported DISCARD reset commands.
src/Npgsql/Internal/NpgsqlConnector.Auth.cs Updated authentication check to use MD5SHA256 instead of ScramSHA256.
src/Npgsql/BackendMessages/AuthenticationMessages.cs Replaced switch expression with a direct construction of AuthenticationSHA256PasswordMessage.
Comments suppressed due to low confidence (2)

src/Npgsql/Internal/NpgsqlConnector.cs:2319

  • [nitpick] Consider removing or cleaning up the commented-out DISCARD commands in the reset message generation to improve code clarity and reduce future maintenance confusion.
//sb.Append("DISCARD SEQUENCES");

src/Npgsql/BackendMessages/AuthenticationMessages.cs:69

  • Replacing the switch expression with a direct instantiation of AuthenticationSHA256PasswordMessage means PlainText and MD5 cases are no longer handled explicitly; verify that this change is intentional and that no unexpected passwordStoreType values will be encountered.
return new AuthenticationSHA256PasswordMessage(passwordStoreType, buf);

@JusterZhu JusterZhu merged commit b869f12 into HuaweiCloudDeveloper:main Apr 27, 2025
6 checks passed
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.

2 participants