Re: Return and sql tuple descriptions are incompatible

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: Return and sql tuple descriptions are incompatible
Дата
Msg-id 1398363605872-5801450.post@n5.nabble.com
обсуждение исходный текст
Ответ на Return and sql tuple descriptions are incompatible  ("Hengky Liwandouw" <hengkyliwandouw@gmail.com>)
Ответы Re: Return and sql tuple descriptions are incompatible  ("Hengky Liwandouw" <hengkyliwandouw@gmail.com>)
Список pgsql-general
Hengky Lie wrote
> Select * from crosstab($$select produkid, warehouseid,onhand from vwtest
> order by 1,2$$)
>
> as t (produkid VARCHAR, warehouseid integer)
>
> The crosstab command didn't work with error : Return and sql tuple
> descriptions are incompatible.
>
> I have tried to change productid type to text and warehouseid to float8
> and
> the problem still not solve.
>
> What is wrong with the command ?

Go read: http://www.postgresql.org/docs/9.3/interactive/tablefunc.html
"F.36.1.2. crosstab(text)" again and then, looking at the data you are
passing to the crosstab function, see if you can determine the correct
number of columns that need to be declared in the "as t (...)" section.  The
answer is likely not "2" since one of those is a row name and if you only
have a single warehouse a crosstab seems pointless...

Note that even if "warehouseid" is an integer it is going to be effectively
converted to text since the values of the categories all become column
labels...

David J.






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Return-and-sql-tuple-descriptions-are-incompatible-tp5801414p5801450.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gunnar \"Nick\" Bluth"
Дата:
Сообщение: Re: Patched odbc_dfw for PG >= 9.2 - compiles & works but has issues with NULL representation in ODBC?!?
Следующее
От: Sergey Konoplev
Дата:
Сообщение: Re: WAL archiving from a standby backup strategy Postgresql 9.3