Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-22 Thread Michael Paquier
On Sun, Dec 20, 2015 at 6:49 AM, Pavel Stehule wrote: > attached patch allows align to center. > > everywhere where left/right align was allowed, the center align is allowed Moved to next CF, there is a fresh and new patch. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@post

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-19 Thread Pavel Stehule
2015-12-19 6:55 GMT+01:00 Pavel Stehule : > > > 2015-12-18 21:21 GMT+01:00 Daniel Verite : > >> Pavel Stehule wrote: >> >> > The symbol 'X' in two column mode should be centred - now it is aligned >> to >> > left, what is not nice >> >> Currently print.c does not support centered alignment

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-18 Thread Pavel Stehule
2015-12-18 21:21 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > The symbol 'X' in two column mode should be centred - now it is aligned > to > > left, what is not nice > > Currently print.c does not support centered alignment, only left and right. > Should we add it, it would have

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-18 Thread Daniel Verite
Pavel Stehule wrote: > The symbol 'X' in two column mode should be centred - now it is aligned to > left, what is not nice Currently print.c does not support centered alignment, only left and right. Should we add it, it would have to work for all output formats (except obviously for "unal

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-18 Thread Pavel Stehule
2015-12-17 21:33 GMT+01:00 Pavel Stehule : > > > 2015-12-14 23:09 GMT+01:00 Daniel Verite : > >> Pavel Stehule wrote: >> >> > postgres=# \crosstabview 4 +month label >> > >> > Maybe using optional int order column instead label is better - then >> you can >> > do sort on client side >> > >

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-17 Thread Pavel Stehule
2015-12-14 23:09 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > postgres=# \crosstabview 4 +month label > > > > Maybe using optional int order column instead label is better - then you > can > > do sort on client side > > > > so the syntax can be "\crosstabview VCol [+/-]HCol [[+-]

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-17 Thread Pavel Stehule
2015-12-14 23:15 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > > here is patch - supported syntax: \crosstabview VCol [+/-]HCol > [HOrderCol] > > > > Order column should to contains any numeric value. Values are sorted on > > client side > > If I understand correctly, I see a prob

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-17 Thread Pavel Stehule
2015-12-14 23:09 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > postgres=# \crosstabview 4 +month label > > > > Maybe using optional int order column instead label is better - then you > can > > do sort on client side > > > > so the syntax can be "\crosstabview VCol [+/-]HCol [[+-]

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-14 Thread Daniel Verite
Pavel Stehule wrote: > here is patch - supported syntax: \crosstabview VCol [+/-]HCol [HOrderCol] > > Order column should to contains any numeric value. Values are sorted on > client side If I understand correctly, I see a problem with HOrderCol. If the vertical header consists of, for

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-14 Thread Daniel Verite
Pavel Stehule wrote: > postgres=# \crosstabview 4 +month label > > Maybe using optional int order column instead label is better - then you can > do sort on client side > > so the syntax can be "\crosstabview VCol [+/-]HCol [[+-]HOrderCol] In the meantime I've followed a different idea:

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-12 Thread Pavel Stehule
2015-12-13 8:14 GMT+01:00 Pavel Stehule : > > > 2015-12-10 19:29 GMT+01:00 Pavel Stehule : > >> >> >> >>> postgres=# \crosstabview 4 +month label >>> >> >> Maybe using optional int order column instead label is better - then you >> can do sort on client side >> >> so the syntax can be "\crosstabvi

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-12 Thread Pavel Stehule
2015-12-10 19:29 GMT+01:00 Pavel Stehule : > > > >> postgres=# \crosstabview 4 +month label >> > > Maybe using optional int order column instead label is better - then you > can do sort on client side > > so the syntax can be "\crosstabview VCol [+/-]HCol [[+-]HOrderCol] > here is patch - support

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-10 Thread Pavel Stehule
> postgres=# \crosstabview 4 +month label > Maybe using optional int order column instead label is better - then you can do sort on client side so the syntax can be "\crosstabview VCol [+/-]HCol [[+-]HOrderCol] Regards Pavel > > ┌──┬───┬───┬┬───┬──

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-08 Thread Pavel Stehule
2015-12-05 8:59 GMT+01:00 Pavel Stehule : > > > 2015-11-30 16:34 GMT+01:00 Daniel Verite : > >> Pavel Stehule wrote: >> >> > [ \rotate being a wrong name ] >> >> Here's an updated patch. >> > > Today I have a time to play with it. I am sorry for delay. > > >> >> First it renames the comman

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-12-05 Thread Pavel Stehule
2015-11-30 16:34 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > [ \rotate being a wrong name ] > > Here's an updated patch. > Today I have a time to play with it. I am sorry for delay. > > First it renames the command to \crosstabview, which hopefully may > be more consensual, a

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-30 Thread Pavel Stehule
2015-11-30 16:34 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > [ \rotate being a wrong name ] > > Here's an updated patch. > > First it renames the command to \crosstabview, which hopefully may > be more consensual, at least it's semantically much closer to crosstab . > thank you

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-30 Thread Daniel Verite
Pavel Stehule wrote: > [ \rotate being a wrong name ] Here's an updated patch. First it renames the command to \crosstabview, which hopefully may be more consensual, at least it's semantically much closer to crosstab . > The important question is sorting output. The vertical header is >

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-05 Thread Joe Conway
On 11/05/2015 12:56 PM, Pavel Stehule wrote: > 2015-11-05 17:17 GMT+01:00 Joe Conway wrote: > Hey, I resemble that remark ;-) > > I am sorry, Joe - no any personal attack - I'll pay a beer for you if > you visit Prague :) No offense taken, but I might take you up on that beer someday ;-) --

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-05 Thread Pavel Stehule
2015-11-05 17:17 GMT+01:00 Joe Conway : > On 11/04/2015 10:46 PM, Pavel Stehule wrote: > > 2015-11-05 7:39 GMT+01:00 Craig Ringer wrote: > > I see constant confusion between \copy and COPY. It's a really good > > reason NOT to overload other psql commands IMO. > > > > but crosstab is one o

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-05 Thread Alvaro Herrera
Joe Conway wrote: > On 11/04/2015 10:46 PM, Pavel Stehule wrote: > > but crosstab is one old function from old extension with unfriendly > > design. > > Hey, I resemble that remark ;-) You may be old all you want, but certainly not unfriendly! -- Álvaro Herrerahttp://www.2ndQua

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-05 Thread Joe Conway
On 11/04/2015 10:46 PM, Pavel Stehule wrote: > 2015-11-05 7:39 GMT+01:00 Craig Ringer wrote: > I see constant confusion between \copy and COPY. It's a really good > reason NOT to overload other psql commands IMO. > > but crosstab is one old function from old extension with unfriendly > des

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Pavel Stehule
2015-11-05 7:39 GMT+01:00 Craig Ringer : > On 5 November 2015 at 05:22, Pavel Stehule > wrote: > > > If I understand to text on wiki, the name is used for tool, that can do > > little bit more things, but it is often used for this technique (so it is > > much better than "rotate"). I don't unders

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Craig Ringer
On 5 November 2015 at 05:22, Pavel Stehule wrote: > If I understand to text on wiki, the name is used for tool, that can do > little bit more things, but it is often used for this technique (so it is > much better than "rotate"). I don't understand well, why "crosstab" is too > wrong name. This i

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread David Fetter
On Wed, Nov 04, 2015 at 08:20:28AM -0800, Joe Conway wrote: > On 11/04/2015 04:09 AM, Pavel Stehule wrote: > > I am looking on this last patch. I talked about the name of this command > > with more people, and the name "rotate" is unhappy. The correct name for > > this visualization technique is "c

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Pavel Stehule
2015-11-05 0:07 GMT+01:00 Daniel Verite : > Pavel Stehule wrote: > > > I am looking on this last patch. I talked about the name of this command > > with more people, and the name "rotate" is unhappy. The correct name for > > this visualization technique is "crosstab" (see google "crosstab"

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Daniel Verite
Joe Conway wrote: > but if you don't want to conflict with the name > crosstab, perhaps "pivot" would be better? Initially I had chosen \pivot without much thought about it, but the objection was raised that a PIVOT/UNPIVOT SQL feature would likely exist in core in a next release independ

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Daniel Verite
Pavel Stehule wrote: > I am looking on this last patch. I talked about the name of this command > with more people, and the name "rotate" is unhappy. The correct name for > this visualization technique is "crosstab" (see google "crosstab"). The > conflict with our extension is unhappy, but

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Pavel Stehule
2015-11-04 17:20 GMT+01:00 Joe Conway : > On 11/04/2015 04:09 AM, Pavel Stehule wrote: > > I am looking on this last patch. I talked about the name of this command > > with more people, and the name "rotate" is unhappy. The correct name for > > this visualization technique is "crosstab" (see googl

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Joe Conway
On 11/04/2015 04:09 AM, Pavel Stehule wrote: > I am looking on this last patch. I talked about the name of this command > with more people, and the name "rotate" is unhappy. The correct name for > this visualization technique is "crosstab" (see google "crosstab"). The > conflict with our extension

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-11-04 Thread Pavel Stehule
Hi I am looking on this last patch. I talked about the name of this command with more people, and the name "rotate" is unhappy. The correct name for this visualization technique is "crosstab" (see google "crosstab"). The conflict with our extension is unhappy, but using "rotate" is more worst - (s

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-21 Thread Marcin Mańk
W dniu piątek, 18 września 2015 Daniel Verite napisał(a): > Pavel Stehule wrote: > > > in the help inside your last patch, you are using "crosstab". Cannto be > > crosstab the name for this feature? > > If it wasn't taken already by contrib/tablefunc, that would be a first > choice. But n

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-21 Thread Daniel Verite
Pavel Stehule wrote: > > So not using \crosstab is deliberate; it's to prevent confusion with > > the server-side function. > > I don't afraid about this - crosstab is a function in extension. Psql > backslash commands living in different worlds. Sure, but the confusion would be assumin

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-19 Thread Pavel Stehule
2015-09-19 8:03 GMT+02:00 Marcin Mańk : > > > W dniu piątek, 18 września 2015 Daniel Verite > napisał(a): > >> Pavel Stehule wrote: >> >> > in the help inside your last patch, you are using "crosstab". Cannto be >> > crosstab the name for this feature? >> >> If it wasn't taken already by

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Pavel Stehule
> You're suggesting a [d] choice, subdividing the horizontal headers. > It seems to me like a pretty radical change, multiplying the number > of columns, and it has also the potential to give poor results visually. > Let's see if more feedback comes. > yes, I know, plan @d needs lot of new code -

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Daniel Verite
Pavel Stehule wrote: > 2. Data column are not well aligned - numbers are aligned as text Thanks for spotting that, it's fixed in the attached new iteration of the patch. > 3. When data are multiattribute - then merging together with space separator > is not practical > > * important i

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Pavel Stehule
2015-09-18 13:59 GMT+02:00 Daniel Verite : > Pavel Stehule wrote: > > > > my comments: > > > > 1. I don't understand why you are use two methods for sorting columns > > (qsort, and query with ORDER BY) > > qsort (with strcmp as the comparator) is only used to determine the > set of distinc

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Daniel Verite
Pavel Stehule wrote: > my comments: > > 1. I don't understand why you are use two methods for sorting columns > (qsort, and query with ORDER BY) qsort (with strcmp as the comparator) is only used to determine the set of distinct values for the vertical and horizontal headers. In fact th

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Pavel Stehule
2015-09-18 13:36 GMT+02:00 Daniel Verite : > Pavel Stehule wrote: > > > in the help inside your last patch, you are using "crosstab". Cannto be > > crosstab the name for this feature? > > If it wasn't taken already by contrib/tablefunc, that would be a first > choice. But now, when searchi

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Daniel Verite
Pavel Stehule wrote: > in the help inside your last patch, you are using "crosstab". Cannto be > crosstab the name for this feature? If it wasn't taken already by contrib/tablefunc, that would be a first choice. But now, when searching for crosstab+postgresql, pages of results come out co

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-18 Thread Pavel Stehule
3. When data are multiattribute - then merging together with space > separator is not practical > > * important information is lost > * same transformation can be done as expression, so this feature is > useless > > Is possible to use one cell per attribute (don't do merge)? > > DATA QUERY: SEL

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-17 Thread Pavel Stehule
Hi 2015-09-16 11:35 GMT+02:00 Daniel Verite : > Hi, > > This is the 2nd iteration of this patch, for comments and review. > > > > my comments: 1. I don't understand why you are use two methods for sorting columns (qsort, and query with ORDER BY) 2. Data column are not well aligned - numbers a

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-17 Thread Pavel Stehule
2015-09-08 22:55 GMT+02:00 Daniel Verite : > Pavel Stehule wrote: > > > rotate ~ sounds like transpose matrix, what is not true in this case. > > The various definitions that I can see, such as > http://dictionary.reference.com/browse/rotate > make no mention of matrices. It applies to any

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-16 Thread Daniel Verite
Hi, This is the 2nd iteration of this patch, for comments and review. Changes: - the arguments can be column names (rather than only numbers). - the horizontal headers are sorted server-side according to their original type. DESC order is possible by prefixing the column arg with a minus si

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-09 Thread Pavel Stehule
> > > \x doesn't exactly rotate it either. \x puts the column headers down > the side instead of across the top, but it doesn't put the rows across > the top instead of down the side. Rather, each row is listed in a > separate chunk. true, it is rotation per one row. I was wrong. > This featu

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-09 Thread Robert Haas
On Tue, Sep 8, 2015 at 4:58 PM, Pavel Stehule wrote: > 2015-09-08 22:55 GMT+02:00 Daniel Verite : >> >> Pavel Stehule wrote: >> >> > rotate ~ sounds like transpose matrix, what is not true in this case. > > for me the relation rotation is exactly what \x does \x doesn't exactly rotate it

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-08 Thread Pavel Stehule
2015-09-08 22:55 GMT+02:00 Daniel Verite : > Pavel Stehule wrote: > > > rotate ~ sounds like transpose matrix, what is not true in this case. > for me the relation rotation is exactly what \x does > > The various definitions that I can see, such as > http://dictionary.reference.com/bro

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-08 Thread Daniel Verite
Pavel Stehule wrote: > rotate ~ sounds like transpose matrix, what is not true in this case. The various definitions that I can see, such as http://dictionary.reference.com/browse/rotate make no mention of matrices. It applies to anything that moves around a pivot or axis. OTOH, the esta

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-08 Thread Robert Haas
On Tue, Sep 8, 2015 at 2:10 PM, David G. Johnston wrote: > On Tue, Sep 8, 2015 at 1:38 PM, Robert Haas wrote: >> On Mon, Sep 7, 2015 at 5:08 PM, David G. Johnston >> wrote: >> > Given the role that psql performs I do think \rotate to be the least >> > problematic choice; I concur that avoiding \

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-08 Thread David G. Johnston
On Tue, Sep 8, 2015 at 1:38 PM, Robert Haas wrote: > On Mon, Sep 7, 2015 at 5:08 PM, David G. Johnston > wrote: > > Given the role that psql performs I do think \rotate to be the least > > problematic choice; I concur that avoiding \pivot is desirable due to > SQL's > > usage. > > I can't agree.

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-08 Thread Robert Haas
On Mon, Sep 7, 2015 at 5:08 PM, David G. Johnston wrote: > Given the role that psql performs I do think \rotate to be the least > problematic choice; I concur that avoiding \pivot is desirable due to SQL's > usage. I can't agree. Rotating a matrix has a well-defined meaning, and this does someth

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-07 Thread David G. Johnston
On Mon, Sep 7, 2015 at 4:18 PM, Pavel Stehule wrote: > > > 2015-09-07 22:14 GMT+02:00 Greg Stark : > >> On Fri, Sep 4, 2015 at 5:08 PM, Daniel Verite >> wrote: >> > I'm not dead set on \rotate and suggested other names >> > previously in [1], but none of them seems decisively >> > superior. >> >

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-07 Thread Pavel Stehule
2015-09-07 22:14 GMT+02:00 Greg Stark : > On Fri, Sep 4, 2015 at 5:08 PM, Daniel Verite > wrote: > > I'm not dead set on \rotate and suggested other names > > previously in [1], but none of them seems decisively > > superior. > > > Fwiw I like \rotate. It's pretty clear what it means and it sound

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-07 Thread Greg Stark
On Fri, Sep 4, 2015 at 5:08 PM, Daniel Verite wrote: > I'm not dead set on \rotate and suggested other names > previously in [1], but none of them seems decisively > superior. Fwiw I like \rotate. It's pretty clear what it means and it sounds similar to but not exactly the same as pivot. -- gr

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-09-04 Thread Daniel Verite
Pavel Stehule wrote: > the name "rotate" is not correct - maybe "\cross" ? I'm not dead set on \rotate and suggested other names previously in [1], but none of them seems decisively superior. The rationale behind rotate is that, it's a synonym of pivot as a verb, and it's not already us

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-08-31 Thread Pavel Stehule
2015-08-29 5:57 GMT+02:00 Pavel Stehule : > > > 2015-08-29 0:48 GMT+02:00 Daniel Verite : > >> Hi, >> >> This is a reboot of my previous proposal for pivoting results in psql, >> with a new patch that generalizes the idea further through a command >> now named \rotate, and some examples. >> >> So

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-08-31 Thread Daniel Verite
I wrote: > What I like in that representation is that it looks good enough > to be pasted directly into a document in a word processor. And ironically, the nice unicode borders came out all garbled in the mail, thanks to a glitch in my setup that mis-reformatted them before sending. Sorry abou

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-08-30 Thread David Fetter
On Sat, Aug 29, 2015 at 12:48:23AM +0200, Daniel Verite wrote: > Hi, > > This is a reboot of my previous proposal for pivoting results in psql, > with a new patch that generalizes the idea further through a command > now named \rotate, and some examples. Neat! Thanks for putting this together :

Re: [HACKERS] [patch] Proposal for \rotate in psql

2015-08-28 Thread Pavel Stehule
2015-08-29 0:48 GMT+02:00 Daniel Verite : > Hi, > > This is a reboot of my previous proposal for pivoting results in psql, > with a new patch that generalizes the idea further through a command > now named \rotate, and some examples. > > So the concept is: having an existing query in the query bu

[HACKERS] [patch] Proposal for \rotate in psql

2015-08-28 Thread Daniel Verite
Hi, This is a reboot of my previous proposal for pivoting results in psql, with a new patch that generalizes the idea further through a command now named \rotate, and some examples. So the concept is: having an existing query in the query buffer, the user can specify two column numbers C1 and C2