Thread: BUG #1187: Problem in SQL Functions on Composite Types

BUG #1187: Problem in SQL Functions on Composite Types

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1187
Logged by:          Eduard Pinchuck

Email address:      edwardo@softprofi.com

PostgreSQL version: 7.5 Dev

Operating system:   FreeBSD 5.1

Description:        Problem in SQL Functions on Composite Types

Details:

Hello. PostgreSQL 7.4.2.
 I have a problem with such sql function...

CREATE SCHEMA "common_references" AUTHORIZATION "ed";

CREATE TABLE "common_references"."zip_codes" (
  "id_zip_code" SERIAL,
  "city_name" CHAR(30) NOT NULL,
  "region_name" CHAR(30),
  "country_name" CHAR(30) NOT NULL,
  "zip_code" TEXT NOT NULL,
  "district_name" TEXT,
  CONSTRAINT "zip_codes_id_zip_code_key" UNIQUE("id_zip_code")
) WITH OIDS;

I had inserted some records...

/* !!!!!!!!!! FUNCTION !!!!!!! */

CREATE OR REPLACE FUNCTION "common_references"."get_zc_el" (integer) RETURNS
SETOF "common_references"."zip_codes" AS'
select * from common_references.zip_codes a
        where a.id_zip_code = $1;
'LANGUAGE 'sql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER;

/* Expression  */

select * from common_references.get_zc_el(1::integer);

/*  had returned  */

ERROR:  query-specified return row and actual function return row do not
match

What is wrong?

Re: BUG #1187: Problem in SQL Functions on Composite Types

From
Tom Lane
Date:
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> ERROR:  query-specified return row and actual function return row do not
> match

> What is wrong?

Dunno, your example works perfectly for me.  How up to date is your copy
of 7.5devel?

            regards, tom lane