Re: BUG #5757: PL/PGSQL composite variable field error reporting

From: "Andrey G(dot)" <andvgal(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5757: PL/PGSQL composite variable field error reporting
Date: 2010-11-18 19:59:18
Message-ID: AANLkTikFRVgN6iQTg9FefakKaq2HqeU3GGr1y+d3BC=d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

No problem, please find a simple test case with its execution result below:

-- ============================================================================
START TRANSACTION;

CREATE TYPE CompositeType AS (
    existing_field TEXT
);

--
CREATE FUNCTION Bug_5757_test()
    RETURNS VOID
AS $$
DECLARE
    v_comp CompositeType;
BEGIN
    IF v_comp.non_existing_field THEN
        NULL;
    END IF;
END;
$$
LANGUAGE plpgsql;

--
SELECT Bug_5757_test();

ROLLBACK;
-- ============================================================================
$ psql -q < pgbug5757.sql
ERROR: missing FROM-clause entry for table "v_comp"
LINE 1: SELECT v_comp.non_existing_field
^
QUERY: SELECT v_comp.non_existing_field
CONTEXT: PL/pgSQL function "bug_5757_test" line 4 at IF
-- ============================================================================

Andrey

2010/11/18 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>
> "Andrey Galkin" <andvgal(at)gmail(dot)com> writes:
> > The following bug has been logged online:
>
> > Bug reference:      5757
> > Logged by:          Andrey Galkin
> > Email address:      andvgal(at)gmail(dot)com
> > PostgreSQL version: 9.0.1
> > Operating system:   Debian unstable
> > Description:        PL/PGSQL composite variable field error reporting
> > Details:
>
> > 1. Create a variable of composite type in PL/PGSQL function
> > 2. Try to reference not existing field of the variable in some statement,
> > like IF
> > 3. Get "missing FROM-clause entry for table" error at runtime
>
> Please provide a complete test-case, not a vague description.
>
>                        regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-11-18 22:22:02 Re: BUG #5757: PL/PGSQL composite variable field error reporting
Previous Message Alvaro Herrera 2010-11-18 18:35:12 Re: Problem with ALTER TABLE - occasional "tuple concurrently updated"