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

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types
Дата
Msg-id 56E9B9C4.6060104@BlueTreble.com
обсуждение исходный текст
Ответ на Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 3/3/16 4:51 AM, Pavel Stehule wrote:
> CREATE TABLE a(a int);
> CREATE TABLE b(a a.a%TYPE)
>
> And the people expecting the living relation between table a and table
> b. So when I do ALTER a.a, then b.a should be changed. What if I drop
> a.a or drop a?
>
> So this is reason, why I don't would this feature in SQL side.

I don't buy that. plpgsql doesn't work that way, so why would this? 
*especially* with the %TYPE decorator.

Now, if the syntax was

CREATE TABLE b(a a.a)

then I would expect b.a to be a foreign key reference to a.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



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

Предыдущее
От: otheus uibk
Дата:
Сообщение: Re: async replication code
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types