Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TDSTK-0005LL-2Y; Mon, 17 Sep 2012 03:58:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TDSTH-0002d0-Ra; Mon, 17 Sep 2012 03:58:09 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q8H3w64E005537; Sun, 16 Sep 2012 23:58:06 -0400 (EDT) From: Tom Lane To: barrybrown@sierracollege.edu cc: pgsql-bugs@postgresql.org, pgsql-docs@postgresql.org Subject: Re: BUG #7543: Invalid table alias: DELETE FROM table * In-reply-to: References: Comments: In-reply-to barrybrown@sierracollege.edu message dated "Sun, 16 Sep 2012 09:01:13 -0000" Date: Sun, 16 Sep 2012 23:58:06 -0400 Message-ID: <5536.1347854286@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/159 X-Sequence-Number: 34154 barrybrown@sierracollege.edu writes: > I sometime see my users delete all rows from a table using a command like > this: > DELETE FROM customer *; > The question is: what is the star? Is it a table alias or an > output_expression? Neither; it specifies to search the table and its inheritance children, ie, the opposite of ONLY. This has been the default behavior (unless you change the setting of sql_inheritance) for many years, so "*" has largely fallen into disuse; but it's still accepted. However ... I went looking for documentation on this point, and I'm darned if I can find any. There certainly used to be some, but apparently somebody got over-eager about editing the docs to reflect the modern default behavior. The "*" doesn't even appear in the syntax summaries for most of the commands where it's allowed, which is flat wrong --- anywhere you can write "ONLY tablename", it's valid to write "tablename*" instead. So we have some docs work to do. Thanks for pointing it out. regards, tom lane