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: pgx TestConnCopyFromLarge encounters EOF prematurely #52722

Closed
rafiss opened this issue Aug 12, 2020 · 3 comments
Closed

sql: pgx TestConnCopyFromLarge encounters EOF prematurely #52722

rafiss opened this issue Aug 12, 2020 · 3 comments
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@rafiss
Copy link
Collaborator

rafiss commented Aug 12, 2020

In pgx copy_from_test.go, TestConnCopyFromLarge fails. The error is:

    copy_from_test.go:99: Unexpected error for CopyFrom: ERROR: read binary tuple: EOF (SQLSTATE XXUUU)

Here's the relevant part of the test

        mustExec(t, conn, `create temporary table foo(
                a int2,
                b int4,
                c int8,
                d varchar,
                e text,
                f date,
                g timestamptz,
                h bytea
        )`)

        tzedTime := time.Date(2010, 2, 3, 4, 5, 6, 0, time.Local)

        inputRows := [][]interface{}{}

        for i := 0; i < 10000; i++ {
                inputRows = append(inputRows, []interface{}{int16(0), int32(1), int64(2), "abc", "efg", time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), tzedTime, []byte{111, 111, 111, 111}})
        }

        copyCount, err := conn.CopyFrom(context.Background(), pgx.Identifier{"foo"}, []string{"a", "b", "c", "d", "e", "f", "g", "h"}, pgx.CopyFromRows(inputRows))
        if err != nil {
                t.Errorf("Unexpected error for CopyFrom: %v", err)
        }

The test passes if the number of inputRows is decreased to 1000.

Deliverable for this ticket: Determine why the test is failing.

Jira issue: CRDB-3925

@rafiss rafiss added C-investigation Further steps needed to qualify. C-label will change. A-sql-pgcompat Semantic compatibility with PostgreSQL labels Aug 12, 2020
@mniewrzal
Copy link

I encounter this issue while using CopyFrom for migrating large amount of data in single execution (500 entries). When I tried to reduce numer of rows (50 entries) to sent I had a different error read binary tuple: partial copy data row (SQLSTATE XXUUU). I was able to use CopyFrom when I reduced batch size to 15.

@rafiss
Copy link
Collaborator Author

rafiss commented Jan 22, 2021

I wonder if this relates to #58069 -- CockroachDB has an incorrect binary encoding for tuples. But I don't see why changing the batch size would affect things.

@rafiss rafiss added this to Triage in SQL Sessions - Deprecated via automation Jan 22, 2021
@rafiss rafiss moved this from Triage to Longer term backlog in SQL Sessions - Deprecated Jan 22, 2021
@rafiss rafiss added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label May 12, 2021
@rafiss
Copy link
Collaborator Author

rafiss commented Jul 22, 2023

This passes now

@rafiss rafiss closed this as completed Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
No open projects
SQL Sessions - Deprecated
Longer term backlog
Development

No branches or pull requests

2 participants