pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14508: PLPGSQL does not recognize nested user defined types
2+ messages / 2 participants
[nested] [flat]

* BUG #14508: PLPGSQL does not recognize nested user defined types
@ 2017-01-23 05:31  nuliknol@gmail.com
  0 siblings, 1 reply; 2+ messages in thread

From: nuliknol@gmail.com @ 2017-01-23 05:31 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14508
Logged by:          Nulik Nol
Email address:      nuliknol@gmail.com
PostgreSQL version: 9.6.1
Operating system:   Linux
Description:        

Details are here:
http://stackoverflow.com/questions/41798781/how-do-i-access-a-field-of-nested-user-defined-types/417...

To reproduce:

sqls $ cat animal.sql 
DROP TYPE IF EXISTS zoo_t CASCADE;
CREATE TYPE zoo_t AS (
    wolf_object         animal_t,
    bear_object         animal_t

);
DROP TYPE IF EXISTS animal_t CASCADE;
CREATE TYPE animal_t AS (
    animal_id           integer,
    animal_color        varchar,
    animal_name         varchar
);
CREATE OR REPLACE FUNCTION animal_func()
RETURNS void AS $$
DECLARE
    v_animal        animal_t;
    v_zoo           zoo_t;
BEGIN
    v_animal.animal_name:='Chupacabras';
    v_zoo.bear_object.animal_name='Mishka';
END;
$$ LANGUAGE PLPGSQL;
Trying to run it:

sqls $ psql dev < animal.sql 
DROP TYPE
CREATE TYPE
NOTICE:  drop cascades to 2 other objects
DETAIL:  drop cascades to composite type zoo_t column wolf_object
drop cascades to composite type zoo_t column bear_object
DROP TYPE
CREATE TYPE
ERROR:  "v_zoo.bear_object.animal_name" is not a known variable
LINE 8:  v_zoo.bear_object.animal_name='Mishka';
         ^
 sqls $ 


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


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

* Re: BUG #14508: PLPGSQL does not recognize nested user defined types
@ 2017-01-23 16:01  Pavel Stehule <pavel.stehule@gmail.com>
  parent: nuliknol@gmail.com
  0 siblings, 0 replies; 2+ messages in thread

From: Pavel Stehule @ 2017-01-23 16:01 UTC (permalink / raw)
  To: nuliknol@gmail.com; +Cc: pgsql-bugs

Hi

2017-01-23 6:31 GMT+01:00 <nuliknol@gmail.com>:

> The following bug has been logged on the website:
>
> Bug reference:      14508
> Logged by:          Nulik Nol
> Email address:      nuliknol@gmail.com
> PostgreSQL version: 9.6.1
> Operating system:   Linux
> Description:
>
> Details are here:
> http://stackoverflow.com/questions/41798781/how-do-i-
> access-a-field-of-nested-user-defined-types/41799522#41799522
>
> To reproduce:
>
> sqls $ cat animal.sql
> DROP TYPE IF EXISTS zoo_t CASCADE;
> CREATE TYPE zoo_t AS (
>     wolf_object         animal_t,
>     bear_object         animal_t
>
> );
> DROP TYPE IF EXISTS animal_t CASCADE;
> CREATE TYPE animal_t AS (
>     animal_id           integer,
>     animal_color        varchar,
>     animal_name         varchar
> );
> CREATE OR REPLACE FUNCTION animal_func()
> RETURNS void AS $$
> DECLARE
>     v_animal        animal_t;
>     v_zoo           zoo_t;
> BEGIN
>     v_animal.animal_name:='Chupacabras';
>     v_zoo.bear_object.animal_name='Mishka';
> END;
> $$ LANGUAGE PLPGSQL;
> Trying to run it:
>
> sqls $ psql dev < animal.sql
> DROP TYPE
> CREATE TYPE
> NOTICE:  drop cascades to 2 other objects
> DETAIL:  drop cascades to composite type zoo_t column wolf_object
> drop cascades to composite type zoo_t column bear_object
> DROP TYPE
> CREATE TYPE
> ERROR:  "v_zoo.bear_object.animal_name" is not a known variable
> LINE 8:  v_zoo.bear_object.animal_name='Mishka';
>          ^
>  sqls $
>
>
It is not a bug - it is missing feature - left part of assign statement can
be variable, array field or record field. Nested structures are not
supported now - maybe in future.

Regards

Pavel Stehule




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

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


end of thread, other threads:[~2017-01-23 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 05:31 BUG #14508: PLPGSQL does not recognize nested user defined types nuliknol@gmail.com
2017-01-23 16:01 ` Pavel Stehule <pavel.stehule@gmail.com>

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