How to right justify text in psql?
How to right justify text in psql?
От:
Brian Sherwood <bdsher@gmail.com>
Дата:
I am running postgresql 9.2.
Is there a way to right justify just one text column?
Re: How to right justify text in psql?
От:
Jov <zhao6014@gmail.com>
Дата:
the column type info can be found in information_schema.column view.
jov
在 2013-5-17 下午11:27,"Brian Sherwood" <bdsher@gmail.com>写道:
BrianI am assuming it would be a function of psql to right justify text, but I can't find any way to do this.I am running postgresql 9.2.Is there a way to right justify just one text column?Thanks
Re: How to right justify text in psql?
От:
Ian Lawrence Barwick <barwick@gmail.com>
Дата:
2013/5/18 Brian Sherwood : > 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