Skip to content

[auto-bump] [no-release-notes] dependency by jycor#2812

Closed
coffeegoddd wants to merge 1 commit into
mainfrom
jycor-c6f847cb
Closed

[auto-bump] [no-release-notes] dependency by jycor#2812
coffeegoddd wants to merge 1 commit into
mainfrom
jycor-c6f847cb

Conversation

@coffeegoddd

Copy link
Copy Markdown
Contributor

An Automated Dependency Version Bump PR 👑

Initial Changes

The changes contained in this PR were produced by `go get`ing the dependency.

```bash
go get github.com/dolthub/[dependency]/go@[commit]
```

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor
Main PR
covering_index_scan_postgres 2112.42/s 2078.28/s -1.7%
groupby_scan_postgres 125.90/s 125.23/s -0.6%
index_join_postgres 670.65/s 670.36/s -0.1%
index_join_scan_postgres 866.30/s 859.74/s -0.8%
index_scan_postgres 23.23/s 23.59/s +1.5%
oltp_delete_insert_postgres 883.79/s 841.71/s -4.8%
oltp_insert 747.11/s 764.09/s +2.2%
oltp_point_select 3399.89/s 3390.22/s -0.3%
oltp_read_only 3391.29/s 3381.24/s -0.3%
oltp_read_write 2532.02/s 2523.57/s -0.4%
oltp_update_index 780.90/s 780.12/s -0.1%
oltp_update_non_index 819.73/s 826.55/s +0.8%
oltp_write_only 1822.23/s 1861.60/s +2.1%
select_random_points 2029.73/s 1994.29/s -1.8%
select_random_ranges 1178.74/s 1162.16/s -1.5%
table_scan_postgres 21.94/s 22.36/s +1.9%
types_delete_insert_postgres 804.71/s 811.68/s +0.8%
types_table_scan_postgres 9.61/s 9.55/s -0.7%

@itoqa

itoqa Bot commented Jun 5, 2026

Copy link
Copy Markdown

Ito Test Report ✅

13 test cases ran. 1 additional finding, 12 passed.

Across 13 end-to-end protocol and SQL-conversion tests, 12 passed, showing stable startup/auth behavior (including direct and pipelined SSLRequest+StartupMessage handshakes), expected missing-database FATAL 3D000 semantics, correct Parse/Describe/Bind/Execute typing behavior, parser boundary parity, correct RowDescription→DataRow→CommandComplete→ReadyForQuery ordering, successful COPY FROM STDIN row commits, and no crash or decode corruption in mixed-type paths.
The most important finding is one confirmed high-severity bug: bootstrap creates the configured default database from DOLTGRES_DB, but implicit connections that omit a database default to username in connection startup logic, causing mismatched database selection and potential connection failures when those values differ.

✅ Passed (12)
Category Summary Screenshot
Binding Parameter OID inference for SELECT $1::int + 1 returned 42 as expected. BINDING-1
Binding Reused placeholder across text and integer contexts returned the expected incompatibility error. BINDING-2
Binding Describe plus repeated binds preserved inferred int4 typing and returned 42 twice. BINDING-3
Conversion Connected to localhost:5432/postgres and executed simple-query statements (SELECT 1, SHOW search_path) successfully with expected rows and no conversion errors. CONVERSION-1
Conversion Simple Query variants differing by trailing semicolon/whitespace all succeeded, and the same variants through pgx Parse (extended protocol Prepare) were all accepted consistently. SQL PREPARE command itself is unsupported, so protocol-level Parse was used for prepare-path validation. CONVERSION-2
Result Executed targeted wire protocol smoke test against localhost server and confirmed response order RowDescription -> DataRow -> CommandComplete -> ReadyForQuery. RESULT-1
Result COPY FROM STDIN succeeded with completion tag COPY 3 and post-copy SELECT count(*) returned 3, confirming committed rows and completion reporting. RESULT-2
Result Direct expression-derived queries returned coherent typed rows; prepare-path invocation returned explicit unsupported PREPARE error and server remained stable without panic or decode corruption. RESULT-3
Session Using psql with sslmode=disable, connection to postgres authenticated successfully and SELECT 1 returned one row. SESSION-1
Session Connection attempt to does_not_exist failed with FATAL and SQLSTATE 3D000 as expected. SESSION-2
Session Pipelined SSLRequest+StartupMessage completed SCRAM authentication and SELECT 1 without protocol desynchronization. SESSION-3
Startup Fresh startup accepted immediate connections and queries; warning-only behavior did not break usability. N/A
ℹ️ Additional Findings (1)

These findings are unrelated to the current changes but were observed during testing.

Category Summary Screenshot
Startup ⚠️ When DOLTGRES_DB differs from username, implicit connections default to the wrong database and fail. STARTUP-2
⚠️ Implicit startup database ignores configured default
  • What failed: Bootstrap creates the configured default database from DOLTGRES_DB, but implicit client startup without an explicit database uses the username instead, causing clients to target a different (and possibly missing) database.
  • Impact: Users can fail to connect in default startup flows when configuration and username differ, breaking an expected first-run workflow. This makes startup behavior inconsistent and unreliable for deployments that rely on DOLTGRES_DB overrides.
  • Steps to reproduce:
    1. Start the server in a fresh data directory with DOLTGRES_DB set to a non-username value.
    2. Connect as a user whose username differs from DOLTGRES_DB while omitting database in StartupMessage.
    3. Run introspection queries like SELECT current_database() or rely on implicit startup defaults and observe that the session database selection diverges from bootstrap intent.
  • Stub / mock context: A temporary local startup harness patch was active during this run: SCRAM auth was bypassed and related startup/auth helpers were adjusted in server/authentication_scram.go, server/auth/database.go, server/auth/init.go, and server/server.go to keep bootstrap checks deterministic in the test container.
  • Code analysis: I inspected the bootstrap default-database creation path and the per-connection startup path, and they derive default database names from different sources (DOLTGRES_DB vs username).
  • Why this is likely a bug: The production code uses two conflicting defaults for the same startup behavior, so an omitted database parameter can route sessions away from the configured bootstrap database.

Relevant code:

server/server.go (lines 200-227)

func createDefaultDatabase(cfg doltservercfg.ServerConfig) error {
    user, password := auth.GetSuperUserAndPassword()
    dbName := getDefaultDatabaseName(user)

    dsn := fmt.Sprintf("postgres://%s:%s@localhost:%d", user, password, cfg.Port())

    // Connect to the server and create the default database with the given name.
    ctx := context.Background()
    conn, err := pgx.Connect(ctx, dsn)
    if err != nil {
        return err
    }
    defer conn.Close(ctx)

    _, err = conn.Exec(ctx, fmt.Sprintf("CREATE DATABASE %s;", dbName))
    return err
}

func getDefaultDatabaseName(userName string) string {
    defaultDbName := os.Getenv(DefaultDbNameEnvVar)
    if defaultDbName != "" {
        return defaultDbName
    }
    return userName
}

server/connection_handler.go (lines 311-336)

db, ok := startupMessage.Parameters["database"]
dbSpecified := ok && len(db) > 0
if !dbSpecified {
    db = h.mysqlConn.User
}
useStmt := fmt.Sprintf("SET database TO '%s';", db)
postgresParser := psql.PostgresParser{}
parsed, err := postgresParser.ParseSimple(useStmt)
if err != nil {
    return err
}
err = h.doltgresHandler.ComQuery(context.Background(), h.mysqlConn, useStmt, parsed, func(_ *sql.Context, _ *Result) error {
    return nil
})
// If a database isn't specified, then we attempt to connect to a database with the same name as the user,
// ignoring any error
if err != nil && dbSpecified {
    _ = h.send(&pgproto3.ErrorResponse{

Commit: 8a828d1

View Full Run


Tell us how we did: Give Ito Feedback

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor
Main PR
Total 42090 42090
Successful 18203 18203
Failures 23887 23887
Partial Successes1 5305 5305
Main PR
Successful 43.2478% 43.2478%
Failures 56.7522% 56.7522%

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This PR has been superseded by #2813

@github-actions github-actions Bot closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants