dbTalk Databases Forums  

[BUGS] BUG #2017: column labels ignored on selects from views

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2017: column labels ignored on selects from views in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jolly Chen
 
Posts: n/a

Default [BUGS] BUG #2017: column labels ignored on selects from views - 11-03-2005 , 08:01 AM







The following bug has been logged online:

Bug reference: 2017
Logged by: Jolly Chen
Email address: jolly (AT) gauntletsystems (DOT) com
PostgreSQL version: 8.1RC1
Operating system: Mac OS X 10.4.3
Description: column labels ignored on selects from views
Details:

Note how the column labels work for v2 but not for v1. This problem causes
columns to be mistakenly missing in JDBC ResultSets.


testdb=# create table foo (f1 integer);
CREATE TABLE
testdb=# insert into foo values (1);
INSERT 0 1
testdb=# insert into foo values (2);
INSERT 0 1
testdb=# create view v1 as select sum(f1) as sum from foo;
CREATE VIEW
testdb=# select * from v1;
sum
-----
3
(1 row)

testdb=# select sum as s from v1;
sum
-----
3
(1 row)

testdb=# create view v2 as select f1*10 as tenX from foo;
CREATE VIEW
testdb=# select * from v2;
tenx
------
10
20
(2 rows)

testdb=# select tenX as t from v2;
t
----
10
20
(2 rows)

testdb=# select version();
version

----------------------------------------------------------------------------
-------------------------------------------------------------------
PostgreSQL 8.1RC1 on powerpc-apple-darwin8.3.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build
5026)(1 row)

testdb=#

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2017: column labels ignored on selects from views - 11-03-2005 , 09:24 AM






"Jolly Chen" <jolly (AT) gauntletsystems (DOT) com> writes:
Quote:
testdb=# select sum as s from v1;
sum
-----
3
(1 row)
Good catch. 8.0 and earlier get this right, so it's a regression we
induced somewhere in 8.1 development ... wonder where?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2017: column labels ignored on selects from views - 11-03-2005 , 11:43 AM



"Jolly Chen" <jolly (AT) gauntletsystems (DOT) com> writes:
Quote:
Description: column labels ignored on selects from views
Fixed --- turns out the problem was in some recently-added code to
eliminate unnecessary SubqueryScan nodes. The resnames attached
to the SubqueryScan targetlist items have to be moved down to its
child node, not just dropped.

Thanks for the report!

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.