[GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Just added a new bytea type column to an existing psql table and populated the column entirely with row data. Running into some strange query results: When I select the newly added column by itself I get all the data as expected: SELECT new_col FROM data LIMIT 1; Result: \x8481e7dec3650040b

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Melvin Davidson
Is it possible you have more than one row where state = 'CA'? Putting a LIMIT 1 would then restrict to only 1 row. Have you tried with no limit? IE: SELECT new_col FROM data; On Thu, Nov 26, 2015 at 7:13 PM, mrtruji wrote: > Just added a new bytea type column to an existing

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Sure. I copied my email submisison from my stack exchange posting so couldn't submit the formatted tables there. Below is an example and you are correct that features_bin is the newly added column. I mean EMPTY ROW in that features_bin returns empty. id | state | features_bin

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Used psycopg2 in python to create and fill in the table with the code below: cur.execute('alter table data add features_bin bytea;') for x in features: cur.execute('insert into data (features_bin) values (%s);',[x]) conn.commit() features is a list variable of binary array objects. On

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Hi, Thanks for the reply. The limit is just to simplify results for the examples. The same behavior occurs when each of the three queries are not limited. Whenever I try to filter by the original columns and select the new column the resultant values for the new column are empty. Conversely,

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Melvin Davidson
OK, thanks for clarifying, but just for sanity sake, it would REALLY be nice if you would advise us of the exact version of PostgreSQL and the O/S you are working with. A copy of the table structure would also be helpful. Just one more thing, is it possible you have an index on that table that

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Adrian Klaver
On 11/26/2015 06:10 PM, mrtruji wrote: Hi, Thanks for the reply. The limit is just to simplify results for the examples. The same behavior occurs when each of the three queries are not limited. Whenever I try to filter by the original columns and select the new column the resultant values for

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Melvin Davidson
Look like another case of PEBKAC solved. Thanks Adrian & JOhn for the assist. Happy Thanksgiving everyone. On Thu, Nov 26, 2015 at 10:22 PM, John R Pierce wrote: > On 11/26/2015 7:08 PM, mrtruji wrote: > >> Ok this is strange. Shouldn't it always be one or the other? Total

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Sure thing. Below are the results from your query along with the version and table info. Not sure about the index. I queried the table quite a bit before adding the new column and didn't have any issues. Here is the result from your query: nspname | relname | indexrelname | type | ?column?

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Adrian Klaver
On 11/26/2015 04:13 PM, mrtruji wrote: Just added a new bytea type column to an existing psql table and populated the column entirely with row data. Running into some strange query results: When I select the newly added column by itself I get all the data as expected: |SELECT new_col FROM data

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Adrian Klaver
On 11/26/2015 06:10 PM, mrtruji wrote: Hi, Thanks for the reply. The limit is just to simplify results for the examples. The same behavior occurs when each of the three queries are not limited. Whenever I try to filter by the original columns and select the new column the resultant values for

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
Ok this is strange. Shouldn't it always be one or the other? Total row count for the table is 279,096. doggies=# select count(*) from data where features_bin is null; count 279096 (1 row) doggies=# select count(*) from data where features_bin is not null; count 279096 (1

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread David G. Johnston
On Thursday, November 26, 2015, mrtruji wrote: > Ok this is strange. Shouldn't it always be one or the other? Total row > count for the table is 279,096. > > doggies=# select count(*) from data where features_bin is null; > count > > 279096 > (1 row) > > doggies=#

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread John R Pierce
On 11/26/2015 7:11 PM, mrtruji wrote: for x in features: cur.execute('insert into data (features_bin) values (%s);',[x]) conn.commit() yup, my guess was right. you inserted new rows with the features_bin field, but no other fields. you want to use UPDATE, not INSERT, and you'd

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread mrtruji
On Thu, Nov 26, 2015 at 7:24 PM, Melvin Davidson wrote: > Look like another case of PEBKAC solved. Thanks Adrian & JOhn for the > assist. Happy Thanksgiving everyone. > > On Thu, Nov 26, 2015 at 10:22 PM, John R Pierce > wrote: > >> On 11/26/2015 7:08

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread David G. Johnston
On Thursday, November 26, 2015, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thursday, November 26, 2015, mrtruji > wrote: > >> Ok this is strange. Shouldn't it always be one or the other? Total row >> count

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Melvin Davidson
ok. It looks like a bug tome, and this is Thanksgiving holiday, so probably the developers won't be able to lot at this until Monday. But just to be sure, what happens when you create a new table with the same structure and populate that? And can you do a pg_dump of the table and see if the data

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread Scott Mead
> On Nov 26, 2015, at 21:29, mrtruji wrote: > > Sure thing. Below are the results from your query along with the version and > table info. Not sure about the index. I queried the table quite a bit before > adding the new column and didn't have any issues. > > Here is the

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread John R Pierce
On 11/26/2015 4:13 PM, mrtruji wrote: Just added a new bytea type column to an existing psql table and populated the column entirely with row data. Running into some strange query results: When I select the newly added column by itself I get all the data as expected:. can you show

Re: [GENERAL] Selecting newly added column returns empty but only when selecting with other columns in table

2015-11-26 Thread John R Pierce
On 11/26/2015 7:08 PM, mrtruji wrote: Ok this is strange. Shouldn't it always be one or the other? Total row count for the table is 279,096. doggies=# select count(*) from data where features_bin is null; count 279096 (1 row) doggies=# select count(*) from data where features_bin