TABLE not synonymous with SELECT * FROM? - Mailing list pgsql-hackers

From Colin 't Hart
Subject TABLE not synonymous with SELECT * FROM?
Date
Msg-id CAMon-aT8Z+5yArRsENrk=L=zSRjKCKHy1g=3KkBYT+h0QPXVDw@mail.gmail.com
Whole thread Raw
Responses Re: TABLE not synonymous with SELECT * FROM?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@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



pgsql-hackers by date:

Previous
From: "Erik Rijkers"
Date:
Subject: Re: Minmax indexes
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: ECPG FETCH readahead