The following bug has been logged online:
Bug reference: 2017
Logged by: Jolly Chen
Email address: jolly@gauntletsystems.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=#