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

Fully-qualified table name no longer accepted by copy_from in 2.9.3 #1450

Closed
nschagen opened this issue May 4, 2022 · 1 comment
Closed

Comments

@nschagen
Copy link

nschagen commented May 4, 2022

Hello,

I just upgraded from psycopg2 version 2.8.6 to version 2.9.3 and the following code broke for me:

    from django.db import connection
    from io import StringIO

    f = StringIO("foo\ttrue\t120")

    with connection.cursor() as cursor:
        cursor.copy_from(
            file=f,
            table="public.potential",
            columns=("originalname", "missing", "score")
        )

It gives me the following error:

    UndefinedTable: relation "public.potential" does not exist

When I remove "public." from the table name, it works again.

I would have expected fully-qualified table names to work. Nothing in the postgres documentation of COPY FROM seems to suggest otherwise. I'm using python 3.9.0 and postgresql 12.4.

Thanks in advance!

@dvarrazzo
Copy link
Member

Yes, it was an accidental breakage, see #1294. Please use copy_expert() instead.

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

No branches or pull requests

2 participants