Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-29-2008, 08:30 PM
Bruce Momjian
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Bruce Momjian wrote:
> We have discussed having a formatting mode where aligned output switches
> to expanded output when the row is too wide. One idea would be to
> create an 'auto' mode that would display in aligned, or wrapped if that
> doesn't fit, or expanded if that doesn't fit.


I haven't heard any new ideas of how to resolve this issue in the past
few hours so I will throw out two new ideas.

Have a 'format=auto' mode that does aligned/wrapped/expanded, but only
for screen output --- file/pipe would still use aligned. And have
'format=wrapped' affect file/pipe by requiring the user to specify the
width, or use a default of 72.

Another idea is to require the user to specify the file/pipe output
width when they define format=wrapped, e.g. format=wrapped:75. If they
don't specify the width, 'wrapped' doesn't affect file/pipe. (Perhaps
the width controls screen width too.) (That is effectively what \pset
columns does, but this is more integrated.)

I have heard why people want 'wrapped' to affect file/pipe output, but I
have not heard a clear explanation of why people don't want that. I
personally think that having the screen width affect the width of
file/pipe is odd, but if the user specifies the width, it seems fine to
me. What is the objection?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-29-2008, 08:30 PM
Alvaro Herrera
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Bruce Momjian escribió:

> Have a 'format=auto' mode that does aligned/wrapped/expanded, but only
> for screen output --- file/pipe would still use aligned. And have
> 'format=wrapped' affect file/pipe by requiring the user to specify the
> width, or use a default of 72.


I have a different question. Why are we mixing file and pipe output? I
think the use cases are different and perhaps we should use different
defaults.

For example, most people I've seen writing shell scripts involving psql
output have to pass the -A flag all the time. Perhaps we could change
the default output to unaligned for pipes?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-29-2008, 08:30 PM
Joshua D. Drake
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

On Fri, 25 Apr 2008 10:45:01 -0400
Alvaro Herrera <alvherre@commandprompt.com> wrote:


> I have a different question. Why are we mixing file and pipe
> output? I think the use cases are different and perhaps we should
> use different defaults.
>
> For example, most people I've seen writing shell scripts involving
> psql output have to pass the -A flag all the time. Perhaps we could
> change the default output to unaligned for pipes?


and -t

Sincerely,

Joshua D. Drake



--
The PostgreSQL Company since 1997: http://www.commandprompt.com/
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-29-2008, 08:30 PM
Bruce Momjian
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Alvaro Herrera wrote:
> Bruce Momjian escribi?:
>
> > Have a 'format=auto' mode that does aligned/wrapped/expanded, but only
> > for screen output --- file/pipe would still use aligned. And have
> > 'format=wrapped' affect file/pipe by requiring the user to specify the
> > width, or use a default of 72.

>
> I have a different question. Why are we mixing file and pipe output? I
> think the use cases are different and perhaps we should use different
> defaults.
>
> For example, most people I've seen writing shell scripts involving psql
> output have to pass the -A flag all the time. Perhaps we could change
> the default output to unaligned for pipes?


Yes, that would make sense to me.

I think the people wanting wrapped to control file/pipe don't want it as
the default, but want _some_ way of getting wrapped output into a file.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 04-29-2008, 08:30 PM
Bruce Momjian
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Bruce Momjian escribi?:
> >
> > > Have a 'format=auto' mode that does aligned/wrapped/expanded, but only
> > > for screen output --- file/pipe would still use aligned. And have
> > > 'format=wrapped' affect file/pipe by requiring the user to specify the
> > > width, or use a default of 72.

> >
> > I have a different question. Why are we mixing file and pipe output? I
> > think the use cases are different and perhaps we should use different
> > defaults.
> >
> > For example, most people I've seen writing shell scripts involving psql
> > output have to pass the -A flag all the time. Perhaps we could change
> > the default output to unaligned for pipes?

>
> Yes, that would make sense to me.
>
> I think the people wanting wrapped to control file/pipe don't want it as
> the default, but want _some_ way of getting wrapped output into a file.


Let me add that the patch as it was posted does not have wrapping
affecting file/pipe output unless you also specify a column width with
\pset. This seemed the most logical and tried to satisfy the most
people. You can see this in the documentation changes of the patch:

ftp://momjian.us/pub/postgresql/mypatches/wrap

I have now clarified the documentation in the patch.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 04-29-2008, 08:30 PM
Gregory Stark
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

"Bruce Momjian" <bruce@momjian.us> writes:

>> I think the people wanting wrapped to control file/pipe don't want it as
>> the default, but want _some_ way of getting wrapped output into a file.

>
> Let me add that the patch as it was posted does not have wrapping
> affecting file/pipe output unless you also specify a column width with
> \pset. This seemed the most logical and tried to satisfy the most
> people. You can see this in the documentation changes of the patch:


If you specify format=wrapped and get something other than wrapped it's a bug
and people will undoubtedly report it as such.

If you want a way to specify "wrapped on a terminal but not to a non-terminal"
then you should make that explicit and separate from the column-width
determination.

I'm done with this thread now.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's 24x7 Postgres support!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 04-29-2008, 08:30 PM
Brendan Jurd
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Apr 26, 2008 at 4:46 AM, Gregory Stark wrote:
> If you specify format=wrapped and get something other than wrapped it's a bug
> and people will undoubtedly report it as such.
>


Agree. If I tell psql that I want wrapped output and it gives me
something else when I output to a file, I'm going to be confused.

In particular, I often work up a query in psql, making revisions with
\e, and when I've got the results I want, I do a \g out.txt to dump
the query output into a file.

I expect that the contents of out.txt will be exactly the same as the
query output I've just been crafting in psql.

If I want to output the query in a machine-readable form to a file, I
just use \a to switch to unaligned output.

Aside: \a should probably be changed to toggle between "unaligned" and
"aligned"/"wrapped", whichever of the two you had selected last.

Cheers,
BJ

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIEixE5YBsbHkuyV0RArhoAKDUH/Svt84xPFn7BGRkq7zEWtonpwCg/pOS
66uQ6mKWvxnZLICfAcJzdLw=
=ibbj
-----END PGP SIGNATURE-----

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 04-29-2008, 08:30 PM
Bruce Momjian
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Brendan Jurd wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sat, Apr 26, 2008 at 4:46 AM, Gregory Stark wrote:
> > If you specify format=wrapped and get something other than wrapped it's a bug
> > and people will undoubtedly report it as such.
> >

>
> Agree. If I tell psql that I want wrapped output and it gives me
> something else when I output to a file, I'm going to be confused.
>
> In particular, I often work up a query in psql, making revisions with
> \e, and when I've got the results I want, I do a \g out.txt to dump
> the query output into a file.
>
> I expect that the contents of out.txt will be exactly the same as the
> query output I've just been crafting in psql.


Obviously you have expections of how wrapping should behave. Please
name me an application that has a wrapped mode that has the output to a
file wrap based on the screen width? It isn't 'ls -C'.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 04-29-2008, 08:30 PM
Alvaro Herrera
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

Bruce Momjian escribió:

> Obviously you have expections of how wrapping should behave. Please
> name me an application that has a wrapped mode that has the output to a
> file wrap based on the screen width? It isn't 'ls -C'.


Why would we need to imitate what other apps do? What we need to
investigate is use cases, and how do we cater for each one, making it
easy for the most common while at the same time making it not impossible
for the most obscure.

There is no point in doing things in a certain way just because others
do the same. Are you going to argue that we need to make the server
crash from time to time because other systems do that too?

We came up with dollar quoting which is a completely novel idea AFAIK.
Why can't we come up with other useful, novel designs?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 04-29-2008, 08:30 PM
Brendan Jurd
 
Posts: n/a
Default Re: Proposed patch - psql wraps at window width

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Apr 26, 2008 at 5:21 AM, Bruce Momjian
wrote:
> Obviously you have expections of how wrapping should behave. Please
> name me an application that has a wrapped mode that has the output to a
> file wrap based on the screen width? It isn't 'ls -C'.
>


Trying to draw analogies between psql and other command-line tools is
always going to be a bit of a stretch. Name me any application at all
that tries to produce both human- and machine- readable
representations of arbitrary tabular data.

All I'm saying is, if the user has exlicitly told psql that he wants
wrapped, human-readable output, we should give it to him regardless of
where he wants to put it.

If the user hasn't specified any format at all, then it's fine to play
guessing games and try to select the best format automatically for
him, based on factors like the destination. But IMO once the user
makes a determination about the output format, that's the end of the
story. You toe that line.

Cheers,
BJ

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIEju85YBsbHkuyV0RAgNTAJ4ghWB1SlvuQhsH3ltrbV M5LoMBwACgoTdT
B6UDw4oG5tlwTlcLcJA4xic=
=2lmV
-----END PGP SIGNATURE-----

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523</