Re: RealDictCursor behavior question - Mailing list psycopg

From Christophe Pettus
Subject Re: RealDictCursor behavior question
Date
Msg-id D3CD577E-4339-49A4-8AFA-5435BA0AA7E8@thebuild.com
Whole thread Raw
In response to RealDictCursor behavior question  (Israel Brewster <ibrewster@flyravn.com>)
List 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 by date:

Previous
From: Israel Brewster
Date:
Subject: RealDictCursor behavior question
Next
From: Daniele Varrazzo
Date:
Subject: Re: RealDictCursor behavior question