Thread

  1. Re: [HACKERS] Table aliases in delete statements?

    Tom Lane <tgl@sss.pgh.pa.us> — 1999-12-08T06:27:53Z

    Keith Parks <emkxp01@mtcc.demon.co.uk> writes:
    > Is there any reason for not allowing table aliases in
    > delete statements?
    
    Not much, I suppose, but it's not in SQL92:
    
             <delete statement: searched> ::=
                  DELETE FROM <table name>
                    [ WHERE <search condition> ]
    
    The expansion of <table name> doesn't mention anything about aliases.
    
    As Bruce points out in another followup, there's no real need for
    an alias for the target table; if you have sub-selects that need
    independent references to the target, you can always alias *them*.
    The same goes for INSERT and UPDATE, which also take unadorned
    <table name> as the target table specification.
    
    			regards, tom lane
    
    
  2. Re: [HACKERS] Table aliases in delete statements?

    Brian E Gallew <geek+@cmu.edu> — 1999-12-08T14:00:23Z

    Then <tgl@sss.pgh.pa.us> spoke up and said:
    > Keith Parks <emkxp01@mtcc.demon.co.uk> writes:
    > > Is there any reason for not allowing table aliases in
    > > delete statements?
    > 
    > As Bruce points out in another followup, there's no real need for
    > an alias for the target table; if you have sub-selects that need
    > independent references to the target, you can always alias *them*.
    > The same goes for INSERT and UPDATE, which also take unadorned
    > <table name> as the target table specification.
    
    Unless your query is going to be long enough to run into query length
    limits, aliases are not your friends.  Standard SQL they may be, but
    aliases always end up obscuring queries to those who come along after
    you. 
    
    -- 
    =====================================================================
    | JAVA must have been developed in the wilds of West Virginia.      |
    | After all, why else would it support only single inheritance??    |
    =====================================================================
    | Finger geek@cmu.edu for my public key.                            |
    =====================================================================