Column Values Always Nil -- Possible Bug?

24 views
Skip to first unread message

Walt Askew

unread,
Jan 20, 2015, 10:34:35 AM1/20/15
to rub...@googlegroups.com
I've got a column whose values always come back as null, despite some of the values not actually being null in the database.
The column type is "information_schema.character_data" and the column which is always null is information_schema.columns.column_default.
I am able to query other columns of the same type and get appropriate values back, so I'm worried there's some odd parsing issue at play.
I'm using the latest 0.18.1 version of the pg driver, and I'm querying a redshift database which puts us on postgres 8.

Some code showing the always-null column:

> conn.select_all("SELECT column_name, column_default FROM information_schema.columns WHERE table_schema='waskew' AND table_name='walt_test'")
   
(798.1ms)  SELECT column_name, column_default FROM information_schema.columns WHERE table_schema='waskew' AND table_name='walt_test'
=> [{"column_name"=>"c3", "column_default"=>nil},
 
{"column_name"=>"id", "column_default"=>nil},
 
{"column_name"=>"c2", "column_default"=>nil},
 
{"column_name"=>"c1", "column_default"=>nil},
 
{"column_name"=>"c5", "column_default"=>nil},
 
{"column_name"=>"c4", "column_default"=>nil}]

How it comes back in psql;

dev=> SELECT column_name, column_default FROM information_schema.columns WHERE table_schema='waskew' AND table_name='walt_test';
 column_name
|           column_default            
-------------+-------------------------------------
 c3          
| 2
 id          
| "identity"(2170652, 0, '1,1'::text)
 c2          
|
 c1          
|
 c5          
|
 c4          
|
(6 rows)

An example of an information_schema.character_data column being parsed correctly (is_nullable is of type  information_schema.character_data)

> server.admin_connection.select_all("SELECT column_name, column_default, is_nullable FROM information_schema.columns WHERE table_schema='waskew' AND table_name='walt_test'")
   
(862.3ms)  SELECT column_name, column_default, is_nullable FROM information_schema.columns WHERE table_schema='waskew' AND table_name='walt_test'
=> [{"column_name"=>"c3", "column_default"=>nil, "is_nullable"=>"NO"},
 
{"column_name"=>"id", "column_default"=>nil, "is_nullable"=>"YES"},
 
{"column_name"=>"c2", "column_default"=>nil, "is_nullable"=>"YES"},
 
{"column_name"=>"c1", "column_default"=>nil, "is_nullable"=>"YES"},
 
{"column_name"=>"c5", "column_default"=>nil, "is_nullable"=>"YES"},
 
{"column_name"=>"c4", "column_default"=>nil, "is_nullable"=>"YES"}]


Any ideas or advice on how to start debugging this?
Reply all
Reply to author
Forward
0 new messages