From: | Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allowing empty target list in SELECT (1b4f7f93b4693858cb983af3cd557f6097dab67b) |
Date: | 2014-05-02 06:03:50 |
Message-ID: | BF2827DCCE55594C8D7A8F7FFD3AB7713DDE577B@SZXEML508-MBX.china.huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2014-05-02 06:19:59 | pgaudit - an auditing extension for PostgreSQL |
Previous Message | Michael Paquier | 2014-05-02 05:16:23 | Re: is there a hook by which we can modify input query before postgresql builds raw parse tree |