Re: what exactly is a query structure?

Поиск
Список
Период
Сортировка
От silly sad
Тема Re: what exactly is a query structure?
Дата
Msg-id 4B87976C.4020808@bankir.ru
обсуждение исходный текст
Ответ на Re: what exactly is a query structure?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-sql
On 02/26/10 10:19, A. Kretschmer wrote:
> In response to silly sad :
>> hello.
>>
>> Postgresql 8.3.9
>>
>> CREATE TYPE usr_secrets AS (login TEXT, pass TEXT, shop_pass TEXT);
>>
>> CREATE OR REPLACE FUNCTION get_noobs () RETURNS SETOF usr_secrets AS $$
>> BEGIN
>>    RETURN QUERY SELECT login, '*' as pass, shop_pass FROM noob;
>>    RETURN;
>> END;
>> $$ LANGUAGE plpgsql SECURITY DEFINER;
>>
>> SELECT * from get_noobs();
>>
>> And we have the following error
>>
>> ERROR:  structure of query does not match function result type
>
> Wild guess: your table noob has an other structure as expected, in
> particular login and/or shop_pass are not TEXT.

they are texts.

if we substitute constant '*' with a text field or even a subselect, the 
error disappear.




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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: what exactly is a query structure?
Следующее
От: silly sad
Дата:
Сообщение: Re: what exactly is a query structure?