Re: what exactly is a query structure?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: what exactly is a query structure?
Date: 2010-02-26 07:19:01
Message-ID: 20100226071900.GD11413@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message silly sad 2010-02-26 09:42:04 Re: what exactly is a query structure?
Previous Message silly sad 2010-02-26 06:50:11 what exactly is a query structure?