lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
9.01k stars 909 forks source link

Response to COPY command is interpreted as error #894

Open sittim opened 5 years ago

sittim commented 5 years ago

I initially entered this issue here, but it seems that the error is actually from file pq/conn.go or pq/notify.go.

When using COPY keyword in file_go_execute_in_pq.sql file, the following error shows appears:

Migration failed: pq: unknown response for simple query: 'G' handling 20190903062409-test_data.sql This is isolated COPY command:

COPY public.users (id, name, email, password, confirm_selector, confirm_verifier, confirmed, attempt_count, last_attempt, locked, recover_selector, recover_verifier, recover_token_expiry, o_auth2_u_i_d, o_auth2_provider, o_auth2_access_token, o_auth2_refresh_token, o_auth2_expiry, t_o_t_p_secret_key, s_m_s_phone_number, s_m_s_seed_phone_number, recovery_codes) FROM stdin; 1 username email@gmail.com $2a$1mysecrectpasswordEjCc8XddtcAPW t 0 0001-01-01 0001-01-01 0001-01-01 0001-01-01
. When copy command is executed like so psql -f file_with_above_statement.sql, reply is

COPY 1 So my theory is that the sql-migrate does not recognize the COPY 1 output which is the result of COPY statement and outputs an error;

ddevault commented 3 years ago

I am able to reproduce this, with response 'C' instead.

Fiyin-Anne commented 1 year ago

Hi @ddevault pls were you able to resolve this?