From: silly sad <sad@bankir.ru>
To: A. Kretschmer <andreas.kretschmer@schollglas.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: what exactly is a query structure?
Date: Fri, 26 Feb 2010 12:42:04 +0300
Message-ID: <4B87976C.4020808@bankir.ru> (raw)
In-Reply-To: <20100226071900.GD11413@a-kretschmer.de>
References: <4B876F23.8040401@bankir.ru>
<20100226071900.GD11413@a-kretschmer.de>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sad@bankir.ru, andreas.kretschmer@schollglas.com
Subject: Re: what exactly is a query structure?
In-Reply-To: <4B87976C.4020808@bankir.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox