Re: How to right justify text in psql?

Поиск
Список
Период
Сортировка
От Ian Lawrence Barwick
Тема Re: How to right justify text in psql?
Дата
Msg-id CAB8KJ=hQ+m-dStL6NQm1-phjPX1cZ9TMVqgKORGAA=6SeL+4Dg@mail.gmail.com
обсуждение исходный текст
Ответ на How to right justify text in psql?  (Brian Sherwood <bdsher@gmail.com>)
Список pgsql-sql
2013/5/18 Brian Sherwood <bdsher@gmail.com>:
> I am running postgresql 9.2.
>
> I am assuming it would be a function of psql to right justify text, but I
> can't find any way to do this.
>
> Is there a way to right justify just one text column?

If you mean have the psql client right-justify a particular text column, no I
don't think there's a way to do that.

Assuming the column contains single-width characters with no line breaks,
you could do something with LPAD along these lines:

SELECT LPAD(txtcol, (SELECT MAX(LENGTH(txtcol)) FROM tbl)) FROM tbl

HTH

Ian Barwick



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

Предыдущее
От: Jov
Дата:
Сообщение: Re: How to right justify text in psql?
Следующее
От: JORGE MALDONADO
Дата:
Сообщение: Select statement with except clause