public inbox for [email protected]
help / color / mirror / Atom feedUndocumented trick in SELECT?
2+ messages / 2 participants
[nested] [flat]
* Undocumented trick in SELECT?
@ 2010-04-04 13:01 =?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= <[email protected]>
2010-04-04 16:26 ` Re: Undocumented trick in SELECT? Tom Lane <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: =?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= @ 2010-04-04 13:01 UTC (permalink / raw)
To: pgsql-docs
I'm sorry, but I have not found such construction into documentation:
SELECT tablename FROM tablename;
http://www.postgresql.org/docs/8.4/static/queries-overview.html
say:
[WITH with_queries] SELECT select_list FROM table_expression
[sort_specification]
http://www.postgresql.org/docs/8.4/static/queries-select-lists.html
say:
"The select list determines which columns of the intermediate table are
actually output."
But, table name is not a column.
Reproduce:
tmp=# create table tmp(id SERIAL, name VARCHAR(10));
NOTICE: CREATE TABLE will create implicit sequence "tmp_id_seq" for serial
column "tmp.id"
CREATE TABLE
tmp=# insert into tmp (name) values('John');
INSERT 0 1
tmp=# insert into tmp (name) values('Pol');
INSERT 0 1
tmp=# insert into tmp (name) values('Martin');
INSERT 0 1
tmp=# select tmp from tmp;
tmp
------------
(1,John)
(2,Pol)
(3,Martin)
(3 rows)
What is this? Is this undocumented or am I bad looked in the documentation?
With best wishes,
Victor Vislobokov
St.Peterburg. Russia
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Undocumented trick in SELECT?
2010-04-04 13:01 Undocumented trick in SELECT? =?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= <[email protected]>
@ 2010-04-04 16:26 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2010-04-04 16:26 UTC (permalink / raw)
To: =?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= <[email protected]>; +Cc: pgsql-docs
=?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= <[email protected]> writes:
> I'm sorry, but I have not found such construction into documentation:
> SELECT tablename FROM tablename;
It's a whole-row variable. These aren't terribly well documented but you
can find descriptions of them in places. It's not standard SQL --- I
think we inherited it from PostQUEL and kept it because functions on
composite types don't work very well without composite variables.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-04-04 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-04-04 13:01 Undocumented trick in SELECT? =?KOI8-R?B?98nL1M/SIPfJ08zPws/Lz9c=?= <[email protected]>
2010-04-04 16:26 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox