Re: Update two tables returning id from insert CTE Query

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Update two tables returning id from insert CTE Query
Дата
Msg-id CAKFQuwYgmmJSqaudTMdx+VFDLOfjwW7i1o4RF9n6ptBOmkgy9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Update two tables returning id from insert CTE Query  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-general
On Tue, Sep 27, 2016 at 1:10 PM, Igor Neyman <ineyman@perceptron.com> wrote:

 

Patrick,

 

You need to explain your problems in more “coherent” way, David suggested one.

If you aren’t willing,  people will stop responding to your request, they are not obligated to read your mind.

 


​I'll put it this way - the only conclusion I can draw in reading the provided code is that the data model is screwed up and may not be capable of accommodating this goal.  Albeit this is based upon a incompletely specified model...

​If you want table1 and table2 to have a 1-to-1 relationship then the assignment of the unique key should not occur via next_val() calls in the default expression​ of either table.  When you query "not_monthly" you need to figure out what the new ID should be and explicitly add it to both INSERT statements.

David J.

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

Предыдущее
От: Igor Neyman
Дата:
Сообщение: Re: Update two tables returning id from insert CTE Query
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Update two tables returning id from insert CTE Query