Re: RealDictCursor behavior question

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: RealDictCursor behavior question
Дата
Msg-id D3CD577E-4339-49A4-8AFA-5435BA0AA7E8@thebuild.com
обсуждение исходный текст
Ответ на RealDictCursor behavior question  (Israel Brewster <ibrewster@flyravn.com>)
Список psycopg
> On Apr 30, 2018, at 11:18, Israel Brewster <ibrewster@flyravn.com> wrote:
>
> When using the RealDictCursor from psycopg2 extras, is the behavior of RealDictCursor well defined for the case where
youhave repeated column names (such as in a join)? That is, obviously a dictionary can only have one value for a key,
sois it safe to assume that the value for the column name key in the case of repeated column names is always going to
bethe one that appears LAST in the query? 

I don't believe it is guaranteed.  The best approach is to rename duplicate column names using AS so you are sure you
aregetting back what you expect. 

--
-- Christophe Pettus
   xof@thebuild.com



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

Предыдущее
От: Israel Brewster
Дата:
Сообщение: RealDictCursor behavior question
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: RealDictCursor behavior question