Skip site navigation (1) Skip section navigation (2)

Bug in procedure When you modificate table

From: "Oleg Serov" <serovov(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug in procedure When you modificate table
Date: 2008-07-04 14:20:46
Message-ID: cec7c6df0807040720i5be5abaem3c2b05008ae364a3@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
SQL BUG CODE:
BEGIN;
SELECT version(); -- "PostgreSQL 8.3.3 on i686-redhat-linux-gnu, compiled by
GCC gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)"
CREATE TYPE "buggy_enum_first" AS ENUM ( 'bug1', 'bug2', 'bug3' );

CREATE TABLE "bug_table" (
  "id" BIGINT NOT NULL,
  "buggy_enum_field" "buggy_enum_first" DEFAULT 'bug1'::buggy_enum_first NOT
NULL,
  CONSTRAINT "test_table_pkey" PRIMARY KEY("id")
) WITHOUT OIDS;


CREATE FUNCTION buggy_procedure() RETURNS SETOF bug_table
    AS $$
BEGIN
    -- @todo hide password
    RETURN QUERY (
        SELECT *
        FROM bug_table
    );
END;
$$
    LANGUAGE plpgsql STRICT SECURITY DEFINER;

SELECT * FROM buggy_procedure(); -- All Okey
DROP TYPE buggy_enum_first CASCADE;
CREATE TYPE "buggy_enum_second" AS ENUM ( 'bug1', 'bug2', 'bug3' );
ALTER TABLE bug_table ADD COLUMN buggy_enum_field buggy_enum_second;
SELECT * FROM buggy_procedure(); -- Bug
ROLLBACK;
/*NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"test_table_pkey" for table "bug_table"Результат запроса с отброшенным
числом строк: 1.

NOTICE:  drop cascades to default for table bug_table column
buggy_enum_fieldNOTICE:  drop cascades to table bug_table column
buggy_enum_field
ERROR:  structure of query does not match function result type
CONTEXT:  PL/pgSQL function "buggy_procedure" line 3 at RETURN QUERY*/

Responses

pgsql-bugs by date

Next:From: Hiroshi SaitoDate: 2008-07-04 16:28:36
Subject: Re: BUG #4274: uuid returns duplicate values
Previous:From: Vitold SDate: 2008-07-04 05:58:43
Subject: BUG #4279: Bad codepage in our web-site

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group