Skip to content

Conversation

igorshubovych
Copy link
Collaborator

No description provided.

@rprieto
Copy link
Contributor

rprieto commented May 8, 2014

Nice one, thanks 👍 Do you mind if we just remove echo '{{query}}' | psql {{database}} in favour of the other one?

It's mostly because there are tools that expect one command per example (like tldr --random in the Node client), so it would just show "or" for the command title.

@edgurgel edgurgel mentioned this pull request May 10, 2014
@igorshubovych
Copy link
Collaborator Author

Surprisingly this is not a trivial question to answer.

Of course you can go with -c option, but it has some limitations. Echoing and using pipe is recommended even in the official documentation:
http://www.postgresql.org/docs/9.2/static/app-psql.html (look for '-c')
I wrote many bash scripts for configuration of PG databases and I can say that doing echo smth | psql is one of the most essential examples. Having additional command echo here does not disturbs me, because echo is one of the basic and simplest commands. Anyway there will be CLI commands, which you will not explain without using other commands, e.g. xargs, grep.

However, of course, the answer of this question depends on the philosophy of tldr project.
If having additional command is against the policy (I have never seen it written anywhere), then I'll remove it.
If you prefer having better example, you'd better leave it.

@rprieto
Copy link
Contributor

rprieto commented May 11, 2014

If echo | psql is the recommended usage, let's definitely keep it! The only issue with the existing page is the or between the examples, which doesn't follow the usual convention, and could break some clients.

- description

`example`

- description

`example`

Maybe if the echo version is superior to the -c version, we should only keep that one? I'd say one of the goals of tldr is to show common usages, without having to dive into complex explanations (there's man for that 😄)... so maybe it's less confusing this way.

Otherwise, I don't have anything against having both, as long as they're listed as separate examples.

@igorshubovych
Copy link
Collaborator Author

Please don't merge it. I figured out simpler way for this command:
psql --host=localhost --port=15432 --username=hidden postgres<<< "SELECT * FROM pg_stat_activity; SELECT * FROM pg_user;"

I've never heard about <<< operator. Now I am investigating it.

igorshubovych added a commit that referenced this pull request May 17, 2014
psql - PostgreSQL CLI client
@igorshubovych igorshubovych merged commit 78b4ec7 into tldr-pages:master May 17, 2014
@waldyrious waldyrious added new command Issues requesting creation of a new page or PRs adding a new page for a command. syntax Issues related to the content and markup of the pages. labels Sep 19, 2016
@waldyrious waldyrious changed the title psql - PostgreSQL CLI client psql: add page Sep 29, 2016
@dmmqz dmmqz mentioned this pull request Sep 7, 2025
35 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new command Issues requesting creation of a new page or PRs adding a new page for a command. syntax Issues related to the content and markup of the pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants