Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b)

Поиск
Список
Период
Сортировка
Искать
От
Rajeev rastogi
Тема
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b)
Дата
в 06:04:12
Msg-id
BF2827DCCE55594C8D7A8F7FFD3AB7713DDE577B@SZXEML508-MBX.china.huawei.com
Ответ на
Список
Дерево обсуждения
Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) Amit Langote <amitlangote09@gmail.com>
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) Amit Langote <amitlangote09@gmail.com>
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) Rajeev rastogi <rajeev.rastogi@huawei.com>
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) David Rowley <dgrowleyml@gmail.com>
Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) Amit Langote <amitlangote09@gmail.com>
On 02 May 2014 10:00, Amit Longote Wrote:

> > I
> > s the following behavior perceived fix-worthy?
> >
> >
> > -- note the
> > '
> > 1's
> >  in the output
> > s
> >
> > po
> > stgres=# CREATE TABLE test AS SELECT;
> > SELECT 1
> >
> > postgres=# insert into test select;
> > INSERT 0 1
> >
> 
> Or maybe, it just means 1 'null' row/record and not no row at all?

It just creates an item pointer and corresponding to that heap tuple header (without data or bitmask for NULL) gets stored as part of this insertion.
So though it does not insert anything (not even NULL) but still it reserve one row position. 
So while SELECT, it will not display anything but it will show actual number of rows.

Even below syntax is also allowed:
CREATE TABLE no_column_table();

IMO, this might be useful for dynamic use of table (later column might be added using 'ALTER') or to use as abstract ancestor in class hierarchy.


Thanks and Regards,
Kumar Rajeev Rastogi

В списке pgsql-hackers по дате отправления
От: Michael Paquier
Дата:
От: Ian Barwick
Дата:
FAQ