postgres: \COPY meta command isn't supported? #1534
-
When I issue a meta command
And it seems the server tried to execute meta command in the server.
I tried to use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Good news, though, this functionality is available. You can call the following method on By mistake, the Usage would look something like this (with Tokio): let file = tokio::fs::File::open("/tmp/yyyy").await?;
// pg_pool: PgPool
let mut copy_in = pg_pool.copy_in_raw("COPY xxxx FROM STDIN (FORMAT CSV)").await?;
copy_in.read_from(file).await?;
let rows_inserted = copy_in.finish().await?; Documentation on the |
Beta Was this translation helpful? Give feedback.
\COPY
as a meta command is specifically a feature of thepsql
client.Good news, though, this functionality is available. You can call the following method on
PgPool
: https://docs.rs/sqlx/0.5.9/sqlx/struct.Pool.html#method.copy_in_rawBy mistake, the
PgCopyIn
type isn't exported, but you can see the public methods on it in the source here: https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/postgres/copy.rs#L142Usage would look something like this (with Tokio):