psql -A parameter unalines continued data wrongly

Поиск
Список
Период
Сортировка
От Kurt De Cauwsemaecker
Тема psql -A parameter unalines continued data wrongly
Дата
Msg-id 99CF48BFA38EF54F9157F22281521FC1A0BB7174@RMS402.rte.antwerpen.local
обсуждение исходный текст
Список pgsql-bugs
PostgreSQL version: 9.4.4 and previous 9.4
Ubuntu version: 14.04 LTS

psql -A parameter unalines continued data wrongly.  The continued data jump=
s to the first column while it should be in the correct column or shoudn't =
be spitted.

Example:

Full formatted output:
$ psql -p 50005 -d postgres -l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
postgres  | postgres | LATIN1   | en_US   | en_US |
template0 | postgres | LATIN1   | en_US   | en_US | =3Dc/postgres          =
+
           |          |          |         |       | postgres=3DCTc/postgre=
s
template1 | postgres | LATIN1   | en_US   | en_US | postgres=3DCTc/postgres=
+
           |          |          |         |       | =3Dc/postgres
(3 rows)

The same but tuples-only:
$ psql -p 50005 -d postgres -l -t
postgres  | postgres | LATIN1   | en_US   | en_US |
template0 | postgres | LATIN1   | en_US   | en_US | =3Dc/postgres          =
+
           |          |          |         |       | postgres=3DCTc/postgre=
s
template1 | postgres | LATIN1   | en_US   | en_US | postgres=3DCTc/postgres=
+
           |          |          |         |       | =3Dc/postgres

Using the -A to unaline output:
$ psql -p 50005 -d postgres -l -t -A
postgres|postgres|LATIN1|en_US|en_US|
template0|postgres|LATIN1|en_US|en_US|=3Dc/postgres
postgres=3DCTc/postgres
template1|postgres|LATIN1|en_US|en_US|postgres=3DCTc/postgres
=3Dc/postgres

The issue also appears with output from the -c parameter:
$ psql -p 50005 -d postgres -c "\list" -t -A
postgres|postgres|LATIN1|en_US|en_US|
template0|postgres|LATIN1|en_US|en_US|=3Dc/postgres
postgres=3DCTc/postgres
template1|postgres|LATIN1|en_US|en_US|postgres=3DCTc/postgres
=3Dc/postgres

Output should be:
$ psql -p 50005 -d postgres -l -t -A
postgres|postgres|LATIN1|en_US|en_US|
template0|postgres|LATIN1|en_US|en_US|=3Dc/postgres
|||||postgres=3DCTc/postgres
template1|postgres|LATIN1|en_US|en_US|postgres=3DCTc/postgres
|||||=3Dc/postgres

It would even be better not to use the line splitting (with the + continuat=
ion sign) when asking for unalined output:
$ psql -p 50005 -d postgres -l -t -A
postgres|postgres|LATIN1|en_US|en_US|
template0|postgres|LATIN1|en_US|en_US|=3Dc/postgres postgres=3DCTc/postgres
template1|postgres|LATIN1|en_US|en_US|postgres=3DCTc/postgres =3Dc/postgres

Derived problem (in trying to get a simple list of database names):
$ psql -p 50005 -d postgres -l -t -A | cut -d"|" -f1
postgres
template0
postgres=3DCTc/postgres   <=3D shouldn't appear
template1
=3Dc/postgres             <=3D shouldn't appear

Workaround for the derived problem:
$ psql -p 50005 -d postgres -l -t | cut -d"|" -f1 | sed -e "s/ //g" | grep =
-v "^$"
postgres
template0
template1

Regards,
Kurt de Cauwsemaecker

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Incomplete Explain for delete
Следующее
От: martin.kevin@gmail.com
Дата:
Сообщение: BUG #13461: Error message appears to use incorrect values