Re: ERROR: return and sql tuple descriptions are incompatible - Mailing list pgsql-admin

From Erik Wienhold
Subject Re: ERROR: return and sql tuple descriptions are incompatible
Date
Msg-id 7kadkskdcixknub2dvc4ovm24q5thdptxj2opu42pninbadonm@h5opztcvzcrh
Whole thread Raw
In response to Re: ERROR: return and sql tuple descriptions are incompatible  (M Sarwar <sarwarmd02@outlook.com>)
Responses Re: ERROR: return and sql tuple descriptions are incompatible
List pgsql-admin
On 2024-05-05 02:38 +0200, M Sarwar wrote:
> TEST1P1 data is coming from the category column, TESTC.TEST_NUMBER.
> TRESULT.TEST_RESULT column is giving value data.

Column TESTC.TEST_NUMBER (i.e. the second column) is ignored by crosstab
and it only requires the use of ORDER BY 1,2 to get correct results.
Output columns TEST1P1 and TEST_RESULT are two of the many value columns
which are only filled by the third result column.

I now remember it's the same issue from your very first crosstab mail:

https://www.postgresql.org/message-id/q2cdz27dkwel73k27ckt2i6g6ce55wzodaogbgfnoqccupqndx%40vz3cnoihz4j5

> As I stated in my first email which has  results of
> '\d bronx.TEST_RESULTS_ALL_MCM_INIt' and
> '\d bronx.TEST_TEST_DETAILS_ALL_MCM_INIT', columns TESTC.TEST_NUMBER
> and TRESULT.TEST_RESULT  data types are  numeric and   character(10) .
> This is as per table definitions.
> 
> Are you suggesting me to use the type either TEXT or some other data
> type in the below clause of the SQL.

I'd say use numeric for TEST1P1 and TEST_RESULT.  But the column names
and types suggest that you expect the second result column in the
crosstab output.  Which isn't possible to my knowledge.

-- 
Erik



pgsql-admin by date:

Previous
From: Scott Ribe
Date:
Subject: Re: ERROR: return and sql tuple descriptions are incompatible
Next
From: Edwin UY
Date:
Subject: Foreign tables - oracle_fdw