TABLE not synonymous with SELECT * FROM?

From: "Colin 't Hart" <colin(at)sharpheart(dot)org>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: TABLE not synonymous with SELECT * FROM?
Date: 2013-11-11 09:15:54
Message-ID: CAMon-aT8Z+5yArRsENrk=L=zSRjKCKHy1g=3KkBYT+h0QPXVDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

According to http://www.postgresql.org/docs/9.3/static/sql-select.html#SQL-TABLE

"

The command

TABLE name

is completely equivalent to

SELECT * FROM name

It can be used as a top-level command or as a space-saving syntax
variant in parts of complex queries.

"

However, this isn't true:

colin(at)corundum:~$ psql
psql (9.4devel, server 9.3.1)
Type "help" for help.

eyedb=# table x;
a
---
1
(1 row)

eyedb=# table x limit 10;
a
---
1
(1 row)

eyedb=# table x where a = 1;
ERROR: syntax error at or near "where"
LINE 1: table x where a = 1;
^
eyedb=#

I would've thought it was implemented as a shortcut for "SELECT *
FROM" at the parse level (ie encounter "TABLE" and insert "SELECT *
FROM" into the parse tree and continue), but it seems there is more to
it.

Is the documentation wrong? Or is something broken?

Cheers,

Colin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Boszormenyi Zoltan 2013-11-11 09:17:54 Re: ECPG FETCH readahead
Previous Message Erik Rijkers 2013-11-11 08:53:49 Re: Minmax indexes