Re: reprise: pretty print viewdefs
От | Andrew Dunstan |
---|---|
Тема | Re: reprise: pretty print viewdefs |
Дата | |
Msg-id | 4EF3B9E6.5050308@dunslane.net обсуждение исходный текст |
Ответ на | Re: reprise: pretty print viewdefs (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: reprise: pretty print viewdefs
|
Список | pgsql-hackers |
On 12/22/2011 06:11 PM, Andrew Dunstan wrote: > > > On 12/22/2011 02:17 PM, Andrew Dunstan wrote: >> >> >> On 12/22/2011 01:05 PM, Tom Lane wrote: >>> Maybe, though I fear it might complicate the ruleutils code a bit. >>> You'd probably have to build the output for a column first and then >>> see how long it is before deciding whether to insert a newline. >>> >>> In short, I don't mind trying to make this work better, but I think it >>> will take more work than a two-line patch. >>> >>> >> >> OK. Let me whip something up. I had already come to the conclusion >> you did about how best to do this. >> >> > > Here's a WIP patch. At least it's fairly localized, but as expected > it's rather more than 2 lines :-). Sample output: > > regression=# \pset format unaligned > Output format is unaligned. > regression=# select pg_get_viewdef('shoelace',true); > pg_get_viewdef > SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, > s.sl_len * u.un_fact AS sl_len_cm > FROM shoelace_data s, unit u > WHERE s.sl_unit = u.un_name; > (1 row) > regression=# > > > I just had an idea. We could invent a flavor of pg_get_viewdef() that > took an int as the second param, that would be the wrap width. For the > boolean case as above, 80 would be implied. 0 would mean always wrap. > psql could be made to default to the window width, or maybe window > width - 1, but we could provide a psql setting that would override it. > > This time with patch. cheers andrew
Вложения
В списке pgsql-hackers по дате отправления: