Re: BUG #13513: Turning a table into a view

Поиск
Список
Период
Сортировка
От Piergiorgio Buongiovanni
Тема Re: BUG #13513: Turning a table into a view
Дата
Msg-id 416591758.338151.1437558796979.JavaMail.zimbra@net-international.com
обсуждение исходный текст
Ответ на Re: BUG #13513: Turning a table into a view  (Andres Freund <andres@anarazel.de>)
Ответы Re: BUG #13513: Turning a table into a view  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
Hi Andres,

thank you very much for your email.

Just only to answer to your question, we are doing some tests with our RAD =
(Instant Developer) and we are trying to "cheating" it.
PostgreSQL is very powerful allowing us to use views as tables through the =
RULE mechanism.
Well. Our RAD doesn't treat views as tables (probably the problem is the JD=
BC driver) and we cannot insert data into a view.
So we create a table, then we import that table into the project and the RA=
D reads all the info (constraints, default values, etc.) and creates the fi=
elds correctly.
At the end we turn the table into a view simply using rules.

However I understand your explanation below and I agree with you.

Thanks very much

Regards

Piergiorgio



----- Messaggio originale -----
Da: "Andres Freund" <andres@anarazel.de>
A: "p buongiovanni" <p.buongiovanni@net-international.com>
Cc: pgsql-bugs@postgresql.org
Inviato: Mercoled=C3=AC, 22 luglio 2015 10:59:06
Oggetto: Re: [BUGS] BUG #13513: Turning a table into a view

On 2015-07-22 08:25:38 +0000, p.buongiovanni@net-international.com wrote:
> I create the table MyTable with a foreign key. In a second time I drop th=
at
> foreign key (using ALTER TABLE command) in order to turn the table MyTabl=
e
> into a view, using the command: CREATE RULE "_RETURN" AS ON SELECT TO
> MyTable DO INSTEAD...
> The server doesn't allow me to esecute this command as it tells me that
> there is a foreign key or a trigger on the table MyTable.
> The problem does not occur if I create the table MyTable without foreign
> keys at the beginnning.

Why are you converting tables to views like that? That's really only
supported to break dependency cycles when restoring dumps...

The "problem" is that we don't reset relhastriggers (and some other
fields) when dropping them, which normally is fine.

Regards,

Andres

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #13513: Turning a table into a view
Следующее
От: Andres Freund
Дата:
Сообщение: Re: BUG #13513: Turning a table into a view