Обсуждение: Format in psql

Поиск
Список
Период
Сортировка

Format in psql

От
Bhuvan A
Дата:
Hi,

I am using pgsql-7.2.3. Can i able to format the output of a SELECT sql in 
psql as perl format? 

Something like,
+--------------+--------------------------------------------------------+
| work_desc_id |                       short_desc                       |
+--------------+--------------------------------------------------------+
|            1 | Short description line 1                               |
|              | Short description line 2                               |
|              | Short description line 3                               |
|              | Short description line n                               |
+--------------+--------------------------------------------------------+

If yes, how can i do this? I have gone through the manual page of psql but
such formatting information donot appear over there. So, hope to get some
details over here. A link would be enough.

regards, 
bhuvaneswaran



Re: Format in psql

От
Tomasz Myrta
Дата:
Bhuvan A wrote:
> Hi,
> 
> I am using pgsql-7.2.3. Can i able to format the output of a SELECT sql in 
> psql as perl format? 
> 
> Something like,
> +--------------+--------------------------------------------------------+
> | work_desc_id |                       short_desc                       |
> +--------------+--------------------------------------------------------+
> |            1 | Short description line 1                               |
> |              | Short description line 2                               |
> |              | Short description line 3                               |
> |              | Short description line n                               |
> +--------------+--------------------------------------------------------+
> 
> If yes, how can i do this? I have gone through the manual page of psql but
> such formatting information donot appear over there. So, hope to get some
> details over here. A link would be enough.
> 
man psql.

Inside psql:
\pset border 2

Regards,
Tomasz Myrta




Re: Format in psql

От
Ian Barwick
Дата:
On Monday 03 February 2003 11:54, Bhuvan A wrote:
> Hi,
>
> I am using pgsql-7.2.3. Can i able to format the output of a SELECT sql in
> psql as perl format?
>
> Something like,
> +--------------+--------------------------------------------------------+
> | work_desc_id |                       short_desc                       |
> +--------------+--------------------------------------------------------+
> |            1 | Short description line 1                               |
> |
> |              | Short description line 2                               |
> |              | Short description line 3                               |
> |              | Short description line n                               |
> +--------------+--------------------------------------------------------+

'fraid I don't understand what you mean by "perl" format.

You can get format in the style above by executing
\pset border 2
in psql.

(SQL*Plus fans should issue \pset border 0and recompile psql without readline support to simulatean Oracle environment
;-)

Place this setting in your .psqlrc file to make it permanent.

Ian Barwick
barwick@gmx.net




Re: Format in psql

От
Bhuvan A
Дата:
> man psql.
> 
> Inside psql:
> \pset border 2
> 

Fine, \pset border 2 draws the border. But it donot format the multi line
value, without affecting the format of other column. I want to format the
multi line column appropriately. It should not affect the format of other
column, similar to perl format ($ man perlform). Hope i am clear.

regards,
bhuvaneswaran