Cannot get count of COPY query
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Hi @porsager thanks for making this library.
We are currently trying to migrate our data base code to this library and don't know how to get the count of a COPY query.
Our code looks like this:
const query = sql`COPY transaction (name) FROM STDIN`;
console.log(query.writeable); // undefined
console.log(await query); // Writeable
Normally one would use the .count property as described here https://github.com/porsager/postgres#count in the docs, but the problem is that in the example above await query is not a Result object but a Writeable (and thus has no .count property).
From the docs it seemed to me that one would have to call .writeable() on the query in order to get the stream but that's not what the console.log shows. I'm I missunderstanding something or should this behave differently?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the COPY query example and compare the documented .count and .writeable entry points with the behavior of await query. Verify what await query returns for COPY FROM STDIN and define done as a documented, usable way to obtain the copied-row count or a clear explanation of the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100