BUG #4037: Manual bug: 2.5. Querying a Table

Started by Daniel Cristian Cruzabout 18 years ago4 messagesbugs
Jump to latest
#1Daniel Cristian Cruz
danielcristian@gmail.com

The following bug has been logged online:

Bug reference: 4037
Logged by: Daniel Cristian Cruz
Email address: danielcristian@gmail.com
PostgreSQL version: 8.3
Operating system: Windows
Description: Manual bug: 2.5. Querying a Table
Details:

Where it says:

"Notice how the AS clause is used to relabel the output column. (The AS
clause is optional.)"

It's wrong, because it causes an error if executed without it.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Cristian Cruz (#1)
Re: BUG #4037: Manual bug: 2.5. Querying a Table

"Daniel Cristian Cruz" <danielcristian@gmail.com> writes:

Where it says:

"Notice how the AS clause is used to relabel the output column. (The AS
clause is optional.)"

It's wrong, because it causes an error if executed without it.

Hmm? You can leave off the AS clause if you want:

SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather;
SELECT city, (temp_hi+temp_lo)/2, date FROM weather;

regards, tom lane

#3Daniel Cristian Cruz
danielcristian@gmail.com
In reply to: Tom Lane (#2)
Re: BUG #4037: Manual bug: 2.5. Querying a Table

Humm...

Reading this way... It sounds like I could write something like this:

SELECT city, (temp_hi+temp_lo)/2 temp_avg, date FROM weather;

Like it work with tables...

2008/3/14, Tom Lane <tgl@sss.pgh.pa.us>:

"Daniel Cristian Cruz" <danielcristian@gmail.com> writes:

Where it says:

"Notice how the AS clause is used to relabel the output column. (The AS
clause is optional.)"

It's wrong, because it causes an error if executed without it.

Hmm? You can leave off the AS clause if you want:

SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather;
SELECT city, (temp_hi+temp_lo)/2, date FROM weather;

regards, tom lane

--
Daniel Cristian Cruz
クルズ クリスチアン ダニエル

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Daniel Cristian Cruz (#3)
Re: BUG #4037: Manual bug: 2.5. Querying a Table

Daniel Cristian Cruz escribi�:

Humm...

Reading this way... It sounds like I could write something like this:

SELECT city, (temp_hi+temp_lo)/2 temp_avg, date FROM weather;

Like it work with tables...

Well, it says "the AS clause", not "the AS keyword". The keyword itself
is not optional if you want to have the clause at all.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support