Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types
Дата
Msg-id CAFj8pRAzQyQgnecbEA_2pQFeCN7itj-yUuDJf_e7b=caDds8Zw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers


2016-01-18 22:21 GMT+01:00 Robert Haas <robertmhaas@gmail.com>:
On Mon, Jan 18, 2016 at 3:51 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> BTW are we all agreed that enabling
>   foo%ARRAYTYPE
> and
>   foo%ELEMENTYPE
> in plpgsql's DECLARE section is what we want for this?

I know that Oracle uses syntax of this general type, but I've always
found it ugly.  It's also pretty non-extensible.  You could want
similar things for range types and any other container types we might
get in the future, but clearly adding new reserved words for each one
is no good.

It doesn't use reserved worlds.
 

One idea that occurs to me is: If you can DECLARE BAR FOO%TYPE, but
then you want to make BAR an array of that type rather than a scalar,
why not write that as DECLARE BAR FOO%TYPE[]?  That seems quite
natural to me.

what you propose for syntax for taking a element of array?
 

I think the part of this patch that makes %TYPE work for more kinds of
types is probably a good idea, although I haven't carefully studied
exactly what it does.

I invite any ideas, but currently used notation is only in direction type->array. The working with symbols looks more difficult, than using words (in design area).

More - the textual form is more near to our system of polymorphics types: anyelement, anyarray, ... We have not anyelement[]

Regards

Pavel
 

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Fwd: [JDBC] Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: [PATCH] Improve spinlock inline assembly for x86.