Re: [HACKERS] Table aliases in delete statements?

From: Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk>
To: hackers(at)postgresql(dot)org, geek+(at)cmu(dot)edu
Subject: Re: [HACKERS] Table aliases in delete statements?
Date: 1999-12-08 22:32:15
Message-ID: 199912082232.WAA00910@mtcc.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Brian E Gallew <geek+(at)cmu(dot)edu>
>Then <tgl(at)sss(dot)pgh(dot)pa(dot)us> spoke up and said:
>> Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)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.

The problem is that it's difficult to refer to the same table twice
in a single query without using aliases.

The trap I fell into was thinking I had to alias both references to
the table.

I'd be interested in seeing alternative solutions to the duplicate
removal problem.

Keith.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Frans Van Elsacker 1999-12-08 22:46:58 Postgresql 6.5.3-2 for redhat 6.1
Previous Message Gunther Schadow 1999-12-08 20:15:19 Advanced projects ... anyone interested?