Re: Function for retreiving datatype

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: Function for retreiving datatype
Дата
Msg-id 41E2C8F3.7090504@blakjak.sytes.net
обсуждение исходный текст
Ответ на Re: Function for retreiving datatype  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Function for retreiving datatype  (Michael Fuhr <mike@fuhr.org>)
Re: Function for retreiving datatype  (Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>)
Список pgsql-general
Michael Fuhr wrote:

>On Tue, Jan 11, 2005 at 03:28:08AM +1100, Brendan Jurd wrote:
>
>
>
>>Does postgres have a function to determine the data type of an
>>argument?
>>
>>
>
>In what context?  What problem are you trying to solve?
>
>
>
Well, I solved the original problem in a different way, but I'd still
like to know whether such a function exists.

The original problem had to do with querying a row-returning function.
I had an SQL function that returned "SETOF record", and I was trying to
use it in the FROM clause of a query.  To do so, you need to provide a
list of column definitions.  I was getting the error about the returned
row types not matching my column defs.  In the end it was a simple
mistake -- I had specified 'text' where I should have specified
'varchar'.  I had thought to use some kind of "gettype" function to find
out exactly what data types my query was returning.

On that note, it might be helpful to increase the verbosity of the
"returned row types" error message, so that it actually explains the
mismatch it encountered.  Something like "Returned column 3 is
varchar(15) but column definition is text" would have made debugging a
whole lot easier.


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: SELECT from multiple tables (not join though)
Следующее
От: Madison Kelly
Дата:
Сообщение: Re: SELECT from multiple tables (not join though)