Skip site navigation (1) Skip section navigation (2)

Re: Insert vs Update syntax

From: Richard Huxton <dev(at)archonet(dot)com>
To: Clodoaldo <clodoaldo(dot)pinto(dot)neto(at)gmail(dot)com>
Cc: Brent Friedman <bfriedman(at)scanonline(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, PostgreSQL - General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert vs Update syntax
Date: 2008-02-29 19:04:17
Message-ID: 47C85731.4090004@archonet.com (view raw or flat)
Thread:
Lists: pgsql-general
Clodoaldo wrote:
> 2008/2/29, Brent Friedman <bfriedman(at)scanonline(dot)com>:
>> If you don't like the standard sql implementation, you could use plsql
>>  or any language to make an abstraction layer/wrapper for this
>>  functionality.  Just pass everything as a key/value pair, in an array or
>>  hashtable structure, to your abstraction layer/wrapper, and it can cycle
>>  through the data structure to do the insert or update for you.
> 
> Ok. I have been playing these tricks for the last 25 years. Please no
> more tricks.

Tricks?

 > If someone knows something about the reason for the
> insert syntax in instead of the Update syntax then please elaborate on
> it.

I believe it's because of the way it reads in English: "INSERT INTO 
<some columns> <these values>". One of the key benefits of SQL was 
supposed to be its ability for non-programmers to use it. As a result, 
they sacrificed consistency for the sake of ease-of-learning.

Of course, once you start writing queries of any complexity, you lose 
the benefits of reading as English.

If you come across a time machine, pop back to the first standards 
meeting and have a word with them, would you?

-- 
   Richard Huxton
   Archonet Ltd

In response to

pgsql-general by date

Next:From: Chris BowlbyDate: 2008-02-29 19:07:11
Subject: Re: issue with an assembled date field
Previous:From: brianDate: 2008-02-29 18:53:18
Subject: Re: issue with an assembled date field

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group