pgcmd
Dev tools
database cli
SHOW HN2019
How HN took it
1 positive, 6 neutral or asking, 1 mixed, 8 critical, out of 16 comments about the project. Thread score -0.29.
Idea: 1 for, 5 againstExecution: 0 for, 2 againstPerformance: 0 for, 1 against
The thread, comment by comment
Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.
positive neutral or mixed critical about another commenter or something else the maker
What HN said
What people liked
Useful for piping Postgres results into other tools.
From 2 comments
I can see this being convenient. I'm surprised that json isn't one of the output formats for pgcli, given that there are already tons of formats including one optimized for Jira…
Renevith on HNYes, it's essentially one line of code but it makes my daily routine of running queries against Postgres and then processing the results with other tools much easier.
soheilpro on HN
Objections
Node dependency is a burden compared with Python, Perl or Go binaries.
From 3 comments
What is the motivation behind writing tools like these in JavaScript? Not everyone is going to have Node or NPM. I don't want to first install NPM to install a utility. But…
travislane on HNThis wasn’t a hate post. It was a legitimate question. My systems have python by default. Why do I want to add another dependency for node plus it’s inherent requirement for…
rswail on HNSure they have python, but which version of python do they have? 2? 3? 3.5? 3.7? Arguably writing command line tools in Node.js has similar problems (8? 10? 12? 12.9?) though it…
koolba on HN
Can be done with psql or json_agg directly.
From 3 comments
What, besides being implemented in Node, makes this substantially different from using the built in json_agg function from Postgres, as in:…
llarsson on HNpsql with right query and right flag can do that.
bagol on HNUse --tuples-only / -t and --no-align / -A. Or -tA for short. For example: ``` $ psql dbname -tAc 'SELECT json_agg(some_table) FROM some_table' ``` That will produce a valid JSON…
bagol on HN
A single line of core logic does not justify a library.
From 2 comments
Just to be clear your “library” is literally one line of code: ``` console.log(JSON.stringify(rows, null, 2)); ``` So what’s the point?
byteshock on HNI guess the reason this is getting downvoted is because there isn't sufficient information in the comment. It's true, however. I find this is rampant in the Node community - For…
thunderbong on HN
Requests
Support postgresql: connection URIs.
From 1 comment
Cool! Now, can we just always use postgresql: scheme URIs for connection information? Also, no passwords on the command-line please -- use a password file, or prompt. Also,…
cryptonector on HN
Avoid passwords on the command line; use a password file or prompt.
From 1 comment
Cool! Now, can we just always use postgresql: scheme URIs for connection information? Also, no passwords on the command-line please -- use a password file, or prompt. Also,…
cryptonector on HN
Add GSS-API support.
From 1 comment
Cool! Now, can we just always use postgresql: scheme URIs for connection information? Also, no passwords on the command-line please -- use a password file, or prompt. Also,…
cryptonector on HN
Release standalone binaries for major platforms.
From 1 comment
The nicest thing to do is release binaries for all major platforms (dependency free if possible). Then code it in whatever you want.
quickthrower2 on HN
Questions
Why write it in JavaScript instead of Perl, Python or Ruby?
From 1 comment
What is the motivation behind writing tools like these in JavaScript? Not everyone is going to have Node or NPM. I don't want to first install NPM to install a utility. But…
travislane on HN
Which psql flags or queries produce JSON output?
From 1 comment
Can you share that query and flag please?
daniub on HN
Alternatives named
psql with row_to_json or json_agg
From 3 comments
What, besides being implemented in Node, makes this substantially different from using the built in json_agg function from Postgres, as in:…
llarsson on HNI was sure most of this existed so I looked it up... Mostly centers around adding row_to_json() to the query. Using the example from the github repo: ``` $ psql -P pager -nqtc…
kbaker on HN``` select array_to_json(array_agg(row_to_json(t))) from (select * from name) t ``` seems to work...
eddyg on HN
pgcli
From 1 comment
I can see this being convenient. I'm surprised that json isn't one of the output formats for pgcli, given that there are already tons of formats including one optimized for Jira…
Renevith on HN
Copy to stdout with CSV converted via jq
From 1 comment
Another approach to this is wrapping the query in a `copy to stdout` statement (either in the .sql or with a tiny wrapper), then converting the CSV to JSON. If you're doing the…
mhd on HN