Re: psql: print values and return the COUNT(*) value to bash?
В списке pgsql-general по дате отправления:
| От | Jehan-Guillaume de Rorthais |
|---|---|
| Тема | Re: psql: print values and return the COUNT(*) value to bash? |
| Дата | |
| Msg-id | 20251229091236.4ebacf38@karst обсуждение исходный текст |
| Ответ на | psql: print values and return the COUNT(*) value to bash? (Ron Johnson <ronljohnsonjr@gmail.com>) |
| Список | pgsql-general |
On Mon, 29 Dec 2025 02:21:41 -0500 Ron Johnson <ronljohnsonjr@gmail.com> wrote: … > More stuff happens after this. I want to print out these four lines, but > also test the COUNT(*) value and bypass other bash commands if the count == > 0. You should probably output your result from psql in a parsable way (CSV ? TSV ? custom ?) for your bash script, then print values from bash. The commands "column" or "printf" could help you format a pretty table if really needed. > Is there any relatively simple way to do this (psql print and return > count(*))? Not in a clean way. To make psql return something else than 0, you need to trigger an error with a failing query to make it return 3 when ON_ERROR_STOP is enabled.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера