apecloud / myduckserver

MySQL & Postgres Analytics, Reimagined
184 stars 8 forks source link

feat(pg): enable COPY FROM STDIN #110

Closed fanyang01 closed 2 weeks ago

fanyang01 commented 3 weeks ago

This PR adds support for PostgreSQL's COPY FROM STDIN command.

$ psql -h 127.0.0.1 -U mysql db01

db01=> \copy t from './t.csv' WITH DELIMITER ',' CSV HEADER;
COPY 12
db01=> select * from t;
 id |  s   |  j
----+------+------
 11 | aa   |   12
 12 | bb   |   23
 13 | cc   |   34
 14 | dd   |   45
 15 | ee   |   56
 16 | ff   |   67
 17 | gg   |   78
 18 | hh   |   89
 19 | ii   |  100
 20 | jj   | 1011
 21 | k\tk | 1213
 22 | l\tl | 1415
TianyuZhang1214 commented 2 weeks ago

How about adding some tests for this feature?

fanyang01 commented 2 weeks ago

@TianyuZhang1214 Done. I have added a basic test. In the next step, we should introduce some sqllogictest-like tools.