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 <t...@sss.pgh.pa.us>
>
> "Andrey Galkin" <andv...@gmail.com> writes:
> > The following bug has been logged online:
>
> > Bug reference:      5757
> > Logged by:          Andrey Galkin
> > Email address:      andv...@gmail.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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to