#15586: Fields with missing columns populated when querying on PostgreSQL
-------------------------------------+-------------------------------------
               Reporter:  sebzur     |        Owner:  nobody
                 Status:  reopened   |    Milestone:
              Component:  Database   |      Version:  1.2
  layer (models, ORM)                |     Keywords:  postgresql
             Resolution:             |    Has patch:  0
           Triage Stage:  Design     |  Needs tests:  0
  decision needed                    |
    Needs documentation:  0          |
Patch needs improvement:  0          |
-------------------------------------+-------------------------------------

Comment (by adrian):

 This is an interesting one! I was able to reproduce it in Postgres 8.4.1.
 The issue seems to be isolated to the column called "name". I tried
 selecting non-existent columns with other names besides "name", and it
 worked as expected, raising an error. Here's an example:

 {{{
 db=# CREATE TABLE test (id INTEGER PRIMARY KEY);
 NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test_pkey"
 for table "test"
 CREATE TABLE
 db=# INSERT INTO test VALUES (1), (2), (3);
 INSERT 0 3
 db=# SELECT "test"."id", "test"."name" FROM "test";
  id | name
 ----+------
   1 | (1)
   2 | (2)
   3 | (3)
 (3 rows)

 db=# SELECT "test"."id", "test"."name2" FROM "test";
 ERROR:  column test.name2 does not exist
 }}}

 Here is a thread from the Postgres mailing list with more info:
 http://archives.postgresql.org/pgsql-general/2010-02/msg01038.php.
 "Calling t.name is the same as name(t) if a column reference is not
 found."

 I agree with the previous comments that we should avoid introspecting the
 database, and I can't immediately think of a user-friendly solution to
 this beyond documenting it for Postgres users. Any ideas?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15586#comment:11>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to