pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5757: PL/PGSQL composite variable field error reporting
4+ messages / 3 participants
[nested] [flat]

* BUG #5757: PL/PGSQL composite variable field error reporting
@ 2010-11-18 16:49 Andrey Galkin <andvgal@gmail.com>
  2010-11-18 17:53 ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Andrey Galkin @ 2010-11-18 16:49 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5757
Logged by:          Andrey Galkin
Email address:      andvgal@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

The error is not very helpful. If it's possible please detect the
incorrectly referenced field at parsing/statement preparing time.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5757: PL/PGSQL composite variable field error reporting
  2010-11-18 16:49 BUG #5757: PL/PGSQL composite variable field error reporting Andrey Galkin <andvgal@gmail.com>
@ 2010-11-18 17:53 ` Tom Lane <tgl@sss.pgh.pa.us>
  2010-11-18 19:59   ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Andrey G. <andvgal@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2010-11-18 17:53 UTC (permalink / raw)
  To: Andrey Galkin <andvgal@gmail.com>; +Cc: pgsql-bugs

"Andrey Galkin" <andvgal@gmail.com> writes:
> The following bug has been logged online:

> Bug reference:      5757
> Logged by:          Andrey Galkin
> Email address:      andvgal@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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5757: PL/PGSQL composite variable field error reporting
  2010-11-18 16:49 BUG #5757: PL/PGSQL composite variable field error reporting Andrey Galkin <andvgal@gmail.com>
  2010-11-18 17:53 ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Tom Lane <tgl@sss.pgh.pa.us>
@ 2010-11-18 19:59   ` Andrey G. <andvgal@gmail.com>
  2010-11-18 22:22     ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Andrey G. @ 2010-11-18 19:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: 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@sss.pgh.pa.us>
>
> "Andrey Galkin" <andvgal@gmail.com> writes:
> > The following bug has been logged online:
>
> > Bug reference:      5757
> > Logged by:          Andrey Galkin
> > Email address:      andvgal@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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5757: PL/PGSQL composite variable field error reporting
  2010-11-18 16:49 BUG #5757: PL/PGSQL composite variable field error reporting Andrey Galkin <andvgal@gmail.com>
  2010-11-18 17:53 ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Tom Lane <tgl@sss.pgh.pa.us>
  2010-11-18 19:59   ` Re: BUG #5757: PL/PGSQL composite variable field error reporting Andrey G. <andvgal@gmail.com>
@ 2010-11-18 22:22     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2010-11-18 22:22 UTC (permalink / raw)
  To: Andrey G. <andvgal@gmail.com>; +Cc: pgsql-bugs

"Andrey G." <andvgal@gmail.com> writes:
> 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;

OK, I did something about that.  Thanks for the report!

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2010-11-18 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 16:49 BUG #5757: PL/PGSQL composite variable field error reporting Andrey Galkin <andvgal@gmail.com>
2010-11-18 17:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-11-18 19:59   ` Andrey G. <andvgal@gmail.com>
2010-11-18 22:22     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox