Re: BUG #7543: Invalid table alias: DELETE FROM table *

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: barrybrown(at)sierracollege(dot)edu
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: Re: BUG #7543: Invalid table alias: DELETE FROM table *
Date: 2012-09-17 03:58:06
Message-ID: 5536.1347854286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs

barrybrown(at)sierracollege(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2012-09-17 03:58:49 Re: BUG #7526: An error occured executing the Microsoft VC++ runtime installer
Previous Message sharkke.w 2012-09-16 13:54:10 BUG #7544: cmd, chcp 65001, show client_encoding, get "not enough memory" error

Browse pgsql-docs by date

  From Date Subject
Next Message Bill Martin 2012-09-18 07:28:25 Re: Planner selects different execution plans depending on limit
Previous Message Tom Lane 2012-09-16 22:16:55 Re: [PERFORM] Planner selects different execution plans depending on limit