Skip to content

Commit

Permalink
copy: add copy carriage return test
Browse files Browse the repository at this point in the history
Purely test change to get %100 line coverage in readTextData.

Informs: cockroachdb#99327
Epic: None
Release note: None
  • Loading branch information
cucaroach committed Jul 18, 2023
1 parent d3dda52 commit 5c03045
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion pkg/sql/pgwire/testdata/pgtest/copy
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,30 @@ ReadyForQuery
{"Type":"CommandComplete","CommandTag":"SELECT 2"}
{"Type":"ReadyForQuery","TxStatus":"I"}

# Test with \r\n instead of \n
send
Query {"String": "DELETE FROM t"}
Query {"String": "COPY t FROM STDIN DELIMITER ','"}
CopyData {"Data": "1,blah\r\n"}
CopyData {"Data": "\\.\r\n"}
CopyDone
Query {"String": "SELECT * FROM t ORDER BY i"}
----

until ignore=RowDescription
ReadyForQuery
ReadyForQuery
ReadyForQuery
----
{"Type":"CommandComplete","CommandTag":"DELETE 2"}
{"Type":"ReadyForQuery","TxStatus":"I"}
{"Type":"CopyInResponse","ColumnFormatCodes":[0,0]}
{"Type":"CommandComplete","CommandTag":"COPY 1"}
{"Type":"ReadyForQuery","TxStatus":"I"}
{"Type":"DataRow","Values":[{"text":"1"},{"text":"blah"}]}
{"Type":"CommandComplete","CommandTag":"SELECT 1"}
{"Type":"ReadyForQuery","TxStatus":"I"}

send
Query {"String": "DELETE FROM t"}
Query {"String": "COPY t FROM STDIN HEADER CSV"}
Expand All @@ -393,7 +417,7 @@ ReadyForQuery
ReadyForQuery
ReadyForQuery
----
{"Type":"CommandComplete","CommandTag":"DELETE 2"}
{"Type":"CommandComplete","CommandTag":"DELETE 1"}
{"Type":"ReadyForQuery","TxStatus":"I"}
{"Type":"CopyInResponse","ColumnFormatCodes":[0,0]}
{"Type":"CommandComplete","CommandTag":"COPY 0"}
Expand Down

0 comments on commit 5c03045

Please sign in to comment.