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

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

2021-01-05 Thread Adam Tauno Williams
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 LEFT OUTER JOIN obj_property t1 ON (t1.obj_id = d.docu