From: Tom Lane <tgl@sss.pgh.pa.us>
To: barrybrown@sierracollege.edu
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-docs@postgresql.org
Subject: Re: BUG #7543: Invalid table alias: DELETE FROM table *
Date: Sun, 16 Sep 2012 23:58:06 -0400
Message-ID: <5536.1347854286@sss.pgh.pa.us> (raw)
In-Reply-To: <E1TDAj3-0008JO-V0@wrigleys.postgresql.org>
References: <E1TDAj3-0008JO-V0@wrigleys.postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, barrybrown@sierracollege.edu, pgsql-docs@postgresql.org
Subject: Re: BUG #7543: Invalid table alias: DELETE FROM table *
In-Reply-To: <5536.1347854286@sss.pgh.pa.us>
References: <E1TDAj3-0008JO-V0@wrigleys.postgresql.org> <5536.1347854286@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox