On Tue, Apr 28, 2015 at 9:58 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Peter Geoghegan (pg@heroku.com) wrote: > On Tue, Apr 28, 2015 at 9:42 AM, Stephen Frost <sfrost@snowman.net> wrote: > > I agree with that, but how are NEW and OLD ambiguous? NEW is clearly > > the tuple being added, while OLD is clearly the existing tuple. > > Yes, but EXCLUDED is neither the tuple being added, nor is it the new > tuple. It's something else entirely.
So? I see this as a prime case for choosing practicality/functionality over precision.
If I was to pick 2 words I would probably pick "PROPOSED" and "EXISTING".
But, the syntax is already verbose and being able to use a three-letter reference has its own appeal.
I don't see that, it's exactly the tuple attempting to be inserted. I agree that it might not be the tuple originally in the INSERT statement due to before triggers, but there isn't an alias anywhere for that.
Now, in 99% of cases there aren't going to be before triggers so I'm not particularly worried about that distinction, nor do I think we need to provide an alias for the tuple from the INSERT piece of the clause, but to say that EXCLUDED isn't the tuple being added doesn't make any sense to me, based on how I read the documentation proposed here: