BUG #1187: Problem in SQL Functions on Composite Types - Mailing list pgsql-bugs

From PostgreSQL Bugs List
Subject BUG #1187: Problem in SQL Functions on Composite Types
Date
Msg-id 20040706153053.26590CF4B5A@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1187: Problem in SQL Functions on Composite Types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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?

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Immutable function in index
Next
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1188: evaluation order of select seems to be wrong