Re: BUG #14330: can not select into `composite data types` in plpgsql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: zoulx1982(at)163(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14330: can not select into `composite data types` in plpgsql
Date: 2016-09-21 07:12:33
Message-ID: CAFj8pRD-LKrq5vprytmn5fOwciBjN45iKTG2BukCRTi53RA2qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

2016-09-21 5:51 GMT+02:00 <zoulx1982(at)163(dot)com>:

> The following bug has been logged on the website:
>
> Bug reference: 14330
> Logged by: lx zou
> Email address: zoulx1982(at)163(dot)com
> PostgreSQL version: 9.5.1
> Operating system: win7 6.1.7601
> Description:
>
> Hi,
> when i use composite type in plpgsql, i found it does't work when i
> select a composite type column into a composite type variable.
> But it can work well when i use another style like this:
> select (y).a,(y).b into tmp from t....
> following is a full example. Thanks.
>
> create type mytype(a int, b text);
> create table mytab(x int, y mytype);
> insert into mytab values(1, (1, 'abcd'));
> do $$
> declare
> tmp mytype;
> begin
> --ERROR: invalid input syntax for integer: "(1,asddd)"
> --CONTEXT: PL/pgSQL function inline_code_block line 6 at SQL
> statement
> select y into strict tmp from mytab;
> raise notice '%,%', (tmp).a, (tmp).b;
> end;
> $$;
>

It is not bug - although I understand so this behave is not unfriendly. The
pattern composite var := composite value is not supported due possible
ambiguous assignment internally in PLpgSQL implementation.

Regards

Pavel Stehule

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2016-09-21 08:06:33 Re: BUG #14329: libpq doesn't send complete client certificate chain on first SSL connection
Previous Message Michael Paquier 2016-09-21 06:50:18 Re: BUG #14326: Unexpected status after crash during exclusive backup