Re: crosstab

2023-03-09 Thread David G. Johnston
On Wednesday, March 8, 2023, Rosebrock, Uwe (Environment, Hobart) < uwe.rosebr...@csiro.au> wrote: > Hi List > > I like to use crosstab to pivot a long list of rows into columns, however > the column labels are created dynamically with the resulting column type > known. > > > > Is there a way pass

Re: CROSSTAB( .. only one column has values... )

2021-01-06 Thread Pavel Stehule
Hi st 6. 1. 2021 v 21:47 odesílatel Daniel Verite napsal: > Pavel Stehule wrote: > > > > *That* is a function of how Postgres set returning functions work, and > not > > > specific to crosstab(). It is not easily fixed. Patches to fix that > would > > > be > > > welcomed! > > > > > > > >

Re: CROSSTAB( .. only one column has values... )

2021-01-06 Thread Daniel Verite
(resent to the list, previous post was rejected) Pavel Stehule wrote: > > *That* is a function of how Postgres set returning functions work, and not > > specific to crosstab(). It is not easily fixed. Patches to fix that would > > be > > welcomed! > > > > https://www.postgresql.org/messag

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Pavel Stehule
Hi út 5. 1. 2021 v 19:45 odesílatel Joe Conway napsal: > On 1/5/21 12:11 PM, Tim Clarke wrote: > > imho the crosstab() function isn't a good implementation. The biggest > failure it > > has is that you must know exactly how many output columns you will have > in the > > result /_prior to running

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Joe Conway
On 1/5/21 10:46 AM, Adam Tauno Williams wrote: > I'm using the crosstab feature and do not understand why I am only > getting values in the first column. > So I put this in as a crosstab: > > SELECT * FROM crosstab( > $$ > $$) AS final_result (invoice_date VARCHAR, "parts" BIGINT, "rent

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Joe Conway
On 1/5/21 12:11 PM, Tim Clarke wrote: > imho the crosstab() function isn't a good implementation. The biggest failure > it > has is that you must know exactly how many output columns you will have in the > result /_prior to running it *That* is a function of how Postgres set returning functions

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Thomas Kellerer
Adam Tauno Williams schrieb am 05.01.2021 um 16:46: I'm using the crosstab feature and do not understand why I am only getting values in the first column. The query: SELECT date_trunc('month', t2.value_date) AS invoice_date, t1.value_string AS invoice_type COUNT(*) FROM document d LE

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Tim Clarke
On 05/01/2021 16:12, David G. Johnston wrote: On Tue, Jan 5, 2021 at 8:46 AM Adam Tauno Williams mailto:awill...@whitemice.org>> wrote: Only the first column has values, all the rest are NULL. I assume I am missing something stupid. I think you are assigning the function more intelligence/effort

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread David G. Johnston
On Tue, Jan 5, 2021 at 8:46 AM Adam Tauno Williams wrote: > Only the first column has values, all the rest are NULL. > I assume I am missing something stupid. > I think you are assigning the function more intelligence/effort than it puts out. >From the documentation: """ The crosstab function p

Re: crosstab function

2019-02-28 Thread Morris de Oryx
Professor Mueller! I believe that we met, long ago. I graduated from your department in 1984 where I worked closely with the wonderful, late Prof. Dipple. Postgres.app is a very easy way to work with Postgres, and it does include support for tablefunc. If you ever want to check which extensions ar

Re: crosstab function

2019-02-26 Thread Ron
On 2/26/19 8:10 PM, Martin Mueller wrote: Thank you for the prompt and clear answer. I work with a Mac (OS 10.4.3) and I used the PostgresApp to install it. I am a very primitive user of Postgres and think of it as Microsoft Access on Steroids. I access it via Aqua Data, Studio, but I don't th

Re: crosstab function

2019-02-26 Thread Ron
On 2/26/19 7:51 PM, Martin Mueller wrote: I run Postgres 10.5.  I understand that there is something called tablefunc and it includes a crosstab function. On Stack Overflow I learn that you import this function. But from where and how?  The Postgres documentation is quite clear and intelligib

Re: crosstab function

2019-02-26 Thread Adrian Klaver
On 2/26/19 6:10 PM, Martin Mueller wrote: Thank you for the prompt and clear answer. I work with a Mac (OS 10.4.3) and I used the PostgresApp to install it. I am a very primitive user of Postgres and think of it as Microsoft Access on Steroids. I access it via Aqua Data, Studio, but I don't th

Re: crosstab function

2019-02-26 Thread Martin Mueller
Thank you for the prompt and clear answer. I work with a Mac (OS 10.4.3) and I used the PostgresApp to install it. I am a very primitive user of Postgres and think of it as Microsoft Access on Steroids. I access it via Aqua Data, Studio, but I don't think that makes any difference On 2/26/19,

Re: crosstab function

2019-02-26 Thread Andrew Gierth
> "Martin" == Martin Mueller writes: Martin> I run Postgres 10.5. I understand that there is something Martin> called tablefunc and it includes a crosstab function. On Stack Martin> Overflow I learn that you import this function. But from where Martin> and how? The Postgres documentation

Re: crosstab function

2019-02-26 Thread Adrian Klaver
On 2/26/19 5:51 PM, Martin Mueller wrote: I run Postgres 10.5.  I understand that there is something called tablefunc and it includes a crosstab function. On Stack Overflow I learn that you import this function. But from where and how?  The Postgres documentation is quite clear and intelligible